TypeInference
时间:2010-10-19 来源:yaofang463
using System;
namespace Chapter2
{
class TypeInference
{
static void Main(string[] args)
{
var name = "Bugs Bunny";
var age = 25;
var isRabbit = true;
Type nameType = name.GetType();
Type ageType = age.GetType();
Type isRabbitType = isRabbit.GetType();
Console.WriteLine("name is type " + nameType.ToString());
Console.WriteLine("age is type " + ageType.ToString());
Console.WriteLine("isRabbit is type " + isRabbitType.ToString());
Console.ReadLine();
return;
}
}
}
结果:name is type System.String
age is type System.Int32
isRabbit is type System.Boolean