C#判断数据类型的简单示例代码

int   i   =   5; 
Console.WriteLine( "i is an int? {0}",i.GetType()==typeof(int));
Console.WriteLine( "i is an int? {0}",typeof(int).IsInstanceOfType(i)); 

 

posted @ 2017-11-09 17:07  幽冥狂_七  阅读(12076)  评论(0编辑  收藏  举报