1
Vote

IEnumerable<T>: Union, Except

description

I frequently wish that the Union<T> and Except<T> had overloads that take a single instance of T. It's not a big deal, but I'm tired of manually placing my instance in an array.
 
public static IEnumerable<T> Union<T>(this IEnumerable<T> coll, params T[] instances)
{
return System.Linq.Enumerable.Union<T>(coll, instances);
}
 
public static IEnumerable<T> Except<T>(this IEnumerable<T> coll, params T[] instances)
{
return System.Linq.Enumerable.Except<T>(coll, instances);
}

comments