I wanted to know the path to LINQ for the general collection.
My Customer class is
class Customer { public string Name { get; set; } public string id { get; set; } }
My collection class
class genericCollection<T> : CollectionBase { public void add(T GenericObject) { this.List.Add(GenericObject); } }
Then I add some data to the client collection
genericCollection<Customer> customers = new genericCollection<Customer>(); customers.add(new Customer {id= "1",Name="Andy"}); customers.add(new Customer { id = "2", Name = "MArk" }); customers.add(new Customer { id = "3", Name = "Jason" }); customers.add(new Customer { id = "4", Name = "Alex" });
Now I can iterate through the clients object using the foreach loop, but how can linq do it.
I want to use something like
var query = from c in customers select c;
But I can not successfully apply it.
Regards, Sub
source share