using System;
using System.Reflection;
public class MyClass<T, V> {
public T membera;
}
public class XClass {
public void MethodA<T>() {
}
}
class Starter {
static void Main() {
Type[] types = { typeof(MyClass<,>), typeof(MyClass<int, int>) };
bool[,] bresp = { {types[0].IsGenericType,
types[0].IsGenericTypeDefinition},
{types[1].IsGenericType,
types[1].IsGenericTypeDefinition}};
Console.WriteLine("Is MyClass<,> a generic type? " + bresp[0, 0]);
Console.WriteLine("Is MyClass<,> open? " + bresp[0, 1]);
Console.WriteLine("Is MyClass<int,int> a generic type? " + bresp[1, 0]);
Console.WriteLine("Is MyClass<int,int> open? " + bresp[1, 1]);
Type tObj = typeof(XClass);
MethodInfo method = tObj.GetMethod("MethodA");
bool[] bMethod ={method.IsGenericMethod, method.IsGenericMethodDefinition};
Console.WriteLine("Is XClass.MethodA<T> a generic method? " + bMethod[0]);
Console.WriteLine("Is XClass.MethodA<T> open? " + bMethod[1]);
}
}