/// <summary> /// /匿名类型测试 /// //参数名称、类型、顺序不同,则同一程序中声明的匿名类型实例不同 /// </summary> class AnonymousType { //测试匿名类型 public static void Test1() { var var1 = new { name = "张三", age = 18 }; string name = var1.name; int age = var1.age; Console.WriteLine("匿名类型测试结果:name:{0},age:{1}", name, age); Console.ReadKey(); }
}