public
static
object
CreateGeneric(Type generic, Type innerType,
params
object
[] args)
{
Type specificType = generic.MakeGenericType(
new
System.Type[] { innerType });
return
Activator.CreateInstance(specificType, args);
}
object
genericList = CreateGeneric(
typeof
(List<>),
typeof
(EC));
获取List<T>中T的类型
public
class
MyClass
{
}
Type t =
typeof
(List<MyClass>).GetGenericArguments()[0];
Console.WriteLine(t.Name);
//输出
//MyClass
bloodish