System.Reflection.ConstructorInfo

来源:互联网 发布:数组长度最多开多大 编辑:程序博客网 时间:2024/06/06 05:20
string typeName="Client.Forms.FormTest";
Type t = System.Type.GetType(typeName);            // Action<string> ShowDebugMsg;            object[] objParams = new object[] { ShowDebugMsg };            Type[] types = new Type[1];            types[0] = typeof(Action<string>);            System.Reflection.ConstructorInfo cStruct = t.GetConstructor(types);  if(cStruct=null)return;            object obj = cStruct.Invoke(objParams);            if (obj != null)            {                Form frm = obj as Form;                frm.MdiParent = this;                frm.Show();            }

0 0
原创粉丝点击