当前位置: 编程技术>.net/c#/asp.net
C#判断数据类型的简单示例代码
来源: 互联网 发布时间:2014-10-27
本文导语: 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));
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));