【C#自省】
1、根据string,获取type。Type.GetType 方法,获取具有指定名称的 Type,执行区分大小写的搜索。
2、根据obj,获取type。Object.GetType 方法,获取当前实例的 Type。
int n1 = 12; int n2 = 82; long n3 = 12; Console.WriteLine("n1 and n2 are the same type: {0}", Object.ReferenceEquals(n1.GetType(), n2.GetType())); Console.WriteLine("n1 and n3 are the same type: {0}", Object.ReferenceEquals(n1.GetType(), n3.GetType())); // The example displays the following output: // n1 and n2 are the same type: True // n1 and n3 are the same type: False