示例代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HiddenClassLocalVariablesDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            var intAge = 27;
            var stringName = "张三";
            var program = new Program();

            if (intAge.GetType() == typeof(Int32))
                Console.WriteLine("intAge变量 是整数类型");
            else
                Console.WriteLine("intAge变量 不是整数类型");

            if (stringName is String)
                Console.WriteLine("stringName变量 是字符串类型");
            else
                Console.WriteLine("stringName变量 不是字符串类型");

            if (program is Program)
                Console.WriteLine("program变量 是Program类型");
            else
                Console.WriteLine("program变量 不是Program类型");
        }
    }
}

尊重作者,转发请注明出处:http://www.cnblogs.com/aaaaa
谢谢阅读,有错请指出,不甚感激。

posted on 2012-09-25 17:11  163com  阅读(144)  评论(0编辑  收藏  举报