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.
1. OfType
2. Where
OfType
E.g
ArrayList myArray = new ArrayList { "one", 1, new object(), "two", 2 };
var stringOnly = myArray.OfType
The above code filters only string types and returns as IEnumerable
Comments