如何创建泛型空对象实例:
default(T)
如何创建泛型对象实例:
Activator.CreateInstance(typeof(T))
如何创建动态泛型对象实例:
Type listType = typeof(List<>).MakeGenericType(new Type[] { type });
IList listObjs = Activator.CreateInstance(listType) as IList;
如何创建泛型空对象实例:
default(T)
如何创建泛型对象实例:
Activator.CreateInstance(typeof(T))
如何创建动态泛型对象实例:
Type listType = typeof(List<>).MakeGenericType(new Type[] { type });
IList listObjs = Activator.CreateInstance(listType) as IList;