/*--===------------------------------------------===---
匿名类型: Anonymouse Type
--===------------------------------------------===---
private static void Main()
{
int[] numArray = new int[] { 3, 5, 1, 9, 2 };
foreach (int num in numArray)
{
Console.Write("{0}\t", num);
}
var type = new {
firstname = "xu",
lastname = "minghui",
age = 0x24
};
Console.WriteLine("\n{0} {1},今年{2}岁。", type.firstname, type.lastname, type.age);
}
--===------------------------------------------===---*/
class xumhLinq
{
static void Main()
{
//int[] score={3,5,1,9,2};
var score=new []{3,5,1,9,2}; //匿名类型
foreach(var v in score)
System.Console.Write("{0}\t",v);
var student = new {firstname="xu", lastname="minghui", age=36};
System.Console.WriteLine("\n{0} {1},今年{2}岁。",
student.firstname, student.lastname, student.age);
}
};
匿名类型: Anonymouse Type
--===------------------------------------------===---
private static void Main()
{
int[] numArray = new int[] { 3, 5, 1, 9, 2 };
foreach (int num in numArray)
{
Console.Write("{0}\t", num);
}
var type = new {
firstname = "xu",
lastname = "minghui",
age = 0x24
};
Console.WriteLine("\n{0} {1},今年{2}岁。", type.firstname, type.lastname, type.age);
}
--===------------------------------------------===---*/
class xumhLinq
{
static void Main()
{
//int[] score={3,5,1,9,2};
var score=new []{3,5,1,9,2}; //匿名类型
foreach(var v in score)
System.Console.Write("{0}\t",v);
var student = new {firstname="xu", lastname="minghui", age=36};
System.Console.WriteLine("\n{0} {1},今年{2}岁。",
student.firstname, student.lastname, student.age);
}
};