You should use System.Collections.Generic.HashSet<T>
You can create it like:
var hashSet = new HashSet<T>(IEnumerable<T>)
and then use methods to compare:
hashSet.SetEquals(IEnumerable<T> list)
- will return true if hashSet and list contains same items
hashSet.Overlaps(IEnumerable<T> list)
- will return true if hashSet contains one of the items from list
hashSet.IsSubsetOf(IEnumerable<T> list)
- will return true if hashSet is subset of the list (order don't matter)
hashSet.IsProperSubsetOf(IEnumerable<T> list)
- same as IsSubsetOf
but order matter
hashSet.IsSupersetOf(IEnumerable<T> list)
- will return true if hashSet is superset of the list (order don't matter)
hashSet.IsProperSupersetOf(IEnumerable<T> list)
- same as IsSupersetOf
but order matter
Also there is methods to modify:
hashSet.UnionWith(IEnumerable<T> list)
- will modify hashSet to contain elements which are exists
in current hashSet or list or in both.
hashSet.symmetricExceptWith(IEnumerable<T> list)
- will modify hashSet to contain elements which are only exists
in current hashSet or list but not in both.
hashSet.IntersectWith(IEnumerable<T> list)
- will modify hashSet to contain elements which are exists
in current hashSet and list.
For more information about HashSet
see MSDN article.