摘要: C# 运行时动态对象创建 运行时动态对象创建(我也不知道该叫什么名字,就姑且这么随便称呼了)确实很势大,应该是很有威力的。程序员,贴代码最直接了: int n = System.Activator.CreateInstance<int>(); 这一句没啥可说的,根据类别创建对象。这里要注意的是int型别是编译时可确定的。不是typeof(int)类型。 Type type = Type.GetType("System.Int32", false, true); object o = System.Activator.CreateInstance(type); D 阅读全文
posted @ 2011-04-28 11:48 Joly-Han 阅读(2455) 评论(0) 推荐(2) 编辑