typeof() 与gettype()的区别
来源:互联网 发布:ae特效软件下载 编辑:程序博客网 时间:2024/05/18 11:10
创建控制台程序,复制一下代码覆盖Program.cs,然后直接按F5运行,并查看结果。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CSType
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(typeof(SamplClass));
//输出CSType.SamplClass
SamplClass s = new SamplClass();
Console.WriteLine(s.GetType());
//输出CSType.SamplClass
//但是typeof不能用于表达式 如:
//Console.WriteLine(typeof(x));
//这样可以,因为int对应的.Net Framework的类型是System.Int32
//Console.WriteLine(typeof(int));
//输出System.Int32
Console.ReadLine();
}
}
class SamplClass
{
public SamplClass()
{
}
}
}
- GetType() 与 typeof 的区别
- typeof() 与gettype()的区别
- typeof 与GetType()的区别
- C#中typeof 与GetType()的区别
- typeof()与GetType()简单区别
- GetType和typeof的区别
- Typeof GetType is 的区别
- C# GetType()与Typeof()的区别
- typeof 与 Type.GetType有什么区别?
- C#中的typeof()和GetType()的区别
- C#中的typeof()和GetType()的区别
- C# GetType和typeof()的区别
- C# GetType和typeof的区别
- C# typeof() 和 GetType()的区别
- C# typeof() 和 GetType() 的区别
- C#中typeof 与GetType()的用法
- typeof与Type.GetType()
- C#/GetType()与typeof
- 基于磁盘逻辑结构的信息隐藏(模拟实现)
- Windows CE SDHC驱动简析(1)-驱动架构(基于WinCE5.0 SMDK2410 BSP的SDHC驱动)
- Linux shell 的测试命令
- Android中debug的应用
- 玻璃效果的实现
- typeof() 与gettype()的区别
- 使窗口一打开就是最大化js代码
- 安全警告——“Windows已经阻止此软件因为无法验证发行者”解决办法
- ALM Networks 开篇
- 在VC中使用 Flash 美化你的程序
- hello csdn
- 微软(北京).NET俱乐部活动 (2010年6月26日) – Visual Studio 2010 /*LIFE RUNS ON CODE*/
- 最全的FLEX网站收集分享
- 感受大师风范——侯捷谈程序人生