C#语言的GetType()方法

使用方法 GetType()(被 Object 基类的所有子类型继承)以获取变量类型:

using System;
using System.Reflection;

// Using GetType to obtain type information:
int i = 42;
Type type = i.GetType();
Console.WriteLine(type);
//输出:System.Int32

原创文章,作者:huoxiaoqiang,如若转载,请注明出处:https://www.huoxiaoqiang.com/experience/csharpe/7919.html

(0)
上一篇 2021年5月4日 23:55
下一篇 2021年5月8日 22:05

相关推荐

发表回复

登录后才能评论