点击这里给我发消息
点击这里给我发消息
¥1891.00元
智超淘宝店
泛型动态创建对象的方式
原创
文章标签 C# WinForm

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);
        }