I\'ve been running into situations where I feel I\'m lacking a LINQ extension method which effectivelly checks if there is no match of the specified predicate in a collection. T
You can write your own Extension Method
:
public static bool None(this IEnumerable collection, Func predicate)
{
return collection.All(p=>predicate(p)==false);
}
Or on IQueryable
as well
public static bool None(this IQueryable collection, Expression> predicate)
{
return collection.All(p=> predicate(p)==false);
}