typeof操作符用于获得系统原型对象的类型
例如:
程序清单7-9:
using System;
class Test
{
static void Main(){
Console.WriteLine(typeof(int));
Console.WriteLine(typeof(System.Int32));
Console.WriteLine(typeof(string));
Console.WriteLine(typeof(double[]));
};
}
产生如下输出。
Int32
Int32
String
Double[]
这表明int和system.int32是同一类型。
本文来自编程入门网:http://www.bianceng.cn/Programming/csharp/200709/4378.htm
本文介绍了C#中typeof操作符的使用方法及其返回值特点。通过示例代码展示了如何获取不同数据类型的系统原型对象类型,包括基本类型如int、string及复杂类型如double数组。
1082

被折叠的 条评论
为什么被折叠?



