泛型动态创建对象的方式
1.最常见的两种创建对象方式
public static T Create() where T : new()
{
return new T();
}
public static object CreateNative()
{
return new object();
}
2.Activator.CreateInstance方式生成对象
public static object CreateReflect(Type type)
{
return Activator.CreateInstance(type);
}