码迷,mamicode.com
首页 > 其他好文 > 详细

C# 反射

时间:2014-10-08 17:42:15      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   ar   for   sp   div   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();

C# 反射

标签:style   blog   color   io   ar   for   sp   div   c   

原文地址:http://www.cnblogs.com/ConstSurpass/p/4011125.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!