IsNullOrEmpty
Check either IList object is null or empty.
Source
/// <summary>
/// Determines whether the given IList object [is null or empty].
/// </summary>
/// <param name="obj">The object.</param>
/// <returns><c>true</c> if the given IList object [is null or empty]; otherwise, <c>false</c>.</returns>
public static bool IsNullOrEmpty(this IList obj)
{
return obj == null || obj.Count == 0;
}
Example
List<string> countryList = null;
if (countryList.IsNullOrEmpty())
{
}
else
{
}
var cityList = new List<string> { "NewYork", "London" };
if (cityList.IsNullOrEmpty())
{
}
else
{
}