using System.Collections;
using System.Collections.Generic;
public static void Main()
var foo = new List<int>();
Console.WriteLine(IEnumerableHelper.IsNullOrEmpty(foo));
Console.WriteLine(bar.IsNullOrEmpty());
catch (System.Exception ex){
Console.WriteLine("An error occured: " + ex.Message);
public static class IEnumerableHelper
public static bool IsNullOrEmpty<T>(this IEnumerable<T> collection){