Skip to content

Instantly share code, notes, and snippets.

@csharpforevermore
Last active December 27, 2018 04:30
Show Gist options
  • Save csharpforevermore/ebb49d0fa21839da2617d1ddead204ff to your computer and use it in GitHub Desktop.
Save csharpforevermore/ebb49d0fa21839da2617d1ddead204ff to your computer and use it in GitHub Desktop.
Does A contain all items of B? When A = actual, B = expected. Both are lists because they implement IEnumerable and so work with LINQ
class Code {
public static bool ContainsAll<T>(this IEnumerable<T> actual, IEnumerable<T> expected) {
return actual.All(a => expected.Contains(a));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment