调用的方法里接收一个List<>类型的参数,里面是自定义的EC类, 我要通过反射构建这List对象
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); //输出 //MyClassbloodish

浙公网安备 33010602011771号