IsNullOrEmpty

public static bool IsNullOrEmpty(this System.Collections.Generic.IEnumerable<T> source)
{
    return source = null || !source.Any();
}
Example:
string[] strArr = null;
int[] intArr = {};
bool[] booArr = {true, false};

bool result1 = strArr.IsNullOrEmpty(); //returns true
bool result2 = intArr.IsNullOrEmpty(); //returns true
bool result3 = booArr.IsNullOrEmpty(); //returns false

Description

Checks if the collection is null or empty

Details

Double click on the code to select all.

 

;