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

System.Type反射(1/3)

时间:2017-06-15 10:35:00      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:blog   ref   png   static   read   stat   als   实验代码   []   

通过System.Type,我们可以获取某个类的全名、命名空间、属性等信息。

实验代码:

static void Main(string[] args)
        {
            //System.Type
            string s = "hello refelction";
            Type t = s.GetType();  //方法一
            Console.WriteLine(t.FullName);
            Type t2 = Type.GetType("system.String", false, true);//方法一
            Console.WriteLine(t2.FullName);
            Type t3 = typeof(string);//方法一
            Console.WriteLine(t3.FullName);
            Console.ReadKey();
        }

效果图:

技术分享

 

System.Type反射(1/3)

标签:blog   ref   png   static   read   stat   als   实验代码   []   

原文地址:http://www.cnblogs.com/birdofparadise/p/7015580.html

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