反射的机制解析:复制粘贴来的

System.Type类
System.Type类对于反射有很重要的作用。它是一个抽象的基类,Type有与每种数据类型对应的派生类,我们使用这个派生类的对象的方法、字段、属性来查找有关该类型的所有信息。
获取给定类型的Type值有三种常用方式:

使用C# typeof运算符
Type t=typeof(string);
使用对象的GetType()方法
string s=”guo”;Type t=s.GetType();
调用Type类的静态方法GetType()
Type t=Type.GetType(“System.String”);
---------------------
作者:changuncle
来源:CSDN
原文:https://blog.csdn.net/xiaouncle/article/details/52983924

猜你喜欢

转载自www.cnblogs.com/sandaman2019/p/10878279.html
今日推荐