Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.