This project is read-only.
2
Vote

EnumerableExtensions.IsNullOrEmpty should use Any instead of Count

description

If you use ".Count() = 0" or ".Count() < 1", the entire sequence will be enumerated to return the total number of items. If you replace this with ".Any()", only the first item in the sequence will be enumerated.
 
public static bool IsNullOrEmpty<T>(this IEnumerable<T> enumerable)
{
return enumerable == null || !enumerable.Any();
}

comments