class Program
{
static void Main(string[] args)
{
var employeeInfo = new { Name="Joe",Id = 42}; //匿名类型
var customerInfo = new { Name = "Jane", Id = "AB123" }; //匿名类型
Console.WriteLine("Name:{0}, Id: {1}",employeeInfo.Name,employeeInfo.Id);
Console.WriteLine("Name:{0}, Id: {1}", customerInfo.Name, customerInfo.Id);
Console.WriteLine("employeeInfo Type is actually:{0}", employeeInfo.GetType() );
Console.WriteLine("customerInfo Type is actually:{0}", customerInfo.GetType() );
}
}
C#的匿名类型
最新推荐文章于 2025-01-21 15:46:39 发布