Skip to content

Instantly share code, notes, and snippets.

@jchandra74
Created April 14, 2015 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchandra74/ecfada097b9793760027 to your computer and use it in GitHub Desktop.
Save jchandra74/ecfada097b9793760027 to your computer and use it in GitHub Desktop.
Generic LINQ Extension
namespace __NAMESPACE__
{
using System.Linq;
using System.Collections.Generic;
/// <summary>
/// Check if expected list items are all in master list
/// </summary>
/// <typeparam name="T">Generic Type</typeparam>
/// <param name="a">Master list</param>
/// <param name="b">Expected list items</param>
/// <returns>true if all items in b are in a</returns>
public static class GenericCollectionExtensions
{
public static bool ContainsAll<T>(this List<T> a, List<T> b)
{
return !b.Except(a).Any();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment