Skip to main content

Posts

Showing posts with the label LINQ

LINQ Filtering Operators

LINQ filtering operators are extension methods on IEnumerable and IQueryable . There are two types of filtering operators 1. OfType 2. Where OfType returns an filtered list of IEnumerable and works on IEnumerable also. E.g ArrayList myArray = new ArrayList { "one", 1, new object(), "two", 2 }; var stringOnly  = myArray.OfType ().Where(i => i.Length > 2); The above code filters only string types and returns as IEnumerable on which you can apply Where filter.