
class Customer
{ private string strCode;
private string strName;
public string Code
{
get { return strCode; }
set { strCode=value; }
}
public string Name
{
get { return strName; }
set { strName = value; }
}
static void Main(string[] args)
{
List myCustomers = new List();
Customer cust1 = new Customer();
cust1.Code = "Code1";
cust1.Name = "Cutsomer1";
Customer cust2 = new Customer();
cust2.Code = "Code2";
cust2.Name = "Cutsomer2";
myCustomers.Add(cust1);
myCustomers.Add(cust2);
var q = from c in myCustomers
select c;
foreach (var val in q)
{
Console.WriteLine("{0} {1}", val.Code ,val.Name);
}
Console.ReadLine();
}
Copyright © 2012 - All Rights Reserved - VKInfotek.com