C# 反射

 System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
            Type[] types = assembly.GetTypes();

  types得到当前程序集下所有的类

 

 Type formType = (Type)((SourceGrid.Cells.Cell)cellContext.Cell).Tag;//将object类型强制转换为指定的类型
            Form form = (Form)System.Activator.CreateInstance(formType);创建指定类型的实例
            form.Owner = this;
            form.Show();
posted @ 2014-10-08 14:26  ConstSurpass  阅读(182)  评论(0)    收藏  举报