I will compose a query to retrieve all the items in a generic List.
public class Customer
{
public int Id;
public string Name;
public Customer(int id, string name)
{
this.Id = id;
this.Name = name;
}
}
List<Customer> cust = new List<Customer>();
cust.Add(new Customer(1008, "Microsoft"));
cust.Add(new Customer(999, "Google"));
cust.Add(new Customer(879, "Yahoo"));
cust.Add(new Customer(1206, "Amazon"));
var names = from p in cust select new {CompanyName=p.Name};
foreach(var name in names)
Console.WriteLine(name.CompanyName);