IsNullOrEmpty

public static bool IsNullOrEmpty<T>(this IEnumerable<T> collection)
        {
            return collection == null || collection.Count() == 0;
        }
Example:
var list = new List<Customer>();
var isEmpty = list.IsNullOrEmpty();

Description

Check whether a collection is null or doesn't contain any elements.

Details

Double click on the code to select all.

 

;