IsSubsetOf List extension

I've created  IsSubsetOf List extension based on discussion at http://stackoverflow.com/questions/332973/linq-check-whether-an-array-is-a-subset-of-another

/// <summary>
  /// Determines whether a System.Collections.Generic.List<T> object is a subset of the specified collection.
  /// http://stackoverflow.com/questions/332973/linq-check-whether-an-array-is-a-subset-of-another
  /// </summary>
  /// <param name="list"></param>
  /// <param name="listToFind"></param>
  /// <returns></returns>
  public static bool IsSubsetOf<T>(this List<T> coll1, List<T> coll2)
  {
   bool isSubset = !coll1.Except(coll2).Any();
   return isSubset;
  }

posted @ Friday, May 13, 2011 10:09 PM
Print

Comments on this entry:

No comments posted yet.

Your comment:



(not displayed)


 
 
 
 
 

Live Comment Preview:

 
«May»
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789