linq list of objects find code example
Example: linq get objects of specific type in list
// LINQ selection by type of an object
Class Base{}
Class A : Base {}
Class B : Base {}
List<Base> collection = new List<Base>();
collection.Add(new A());
collection.Add(new B());
collection.Add(new A());
collection.Add(new A());
collection.Add(new B());
var ofTypeA = collection.OfType<A>();