Mega Code Archive
Returns a Type object that represents a generic type definition from which the current generic type can be constructed
using System;
using System.Reflection;
using System.Collections.Generic;
public class Test
{
public static void Main()
{
Dictionary d = new Dictionary();
Type constructed = d.GetType();
DisplayTypeInfo(constructed);
}
private static void DisplayTypeInfo(Type t)
{
Console.WriteLine(t);
Console.WriteLine("Is this a generic type definition? {0}", t.IsGenericTypeDefinition);
Console.WriteLine("Is it a generic type? {0}", t.IsGenericType);
Type[] typeArguments = t.GetGenericArguments();
Console.WriteLine("List type arguments ({0}):", typeArguments.Length);
foreach (Type tParam in typeArguments)
{
Console.WriteLine(tParam);
}
}
}