How to check whether two HashSets are equal in C# .NET
September 1, 2017 Leave a comment
Two HashSet objects in C# are equal if they contain the same values regardless of their order in the collection.
Consider the following integer sets:
HashSet<int> intHashSetOne = new HashSet<int>()
{
1,2,6,5,7,5
};
HashSet<int> intHashSetTwo = new HashSet<int>()
{
2,2,8,5,9,4
};
HashSet<int> intHashSetThree = new HashSet<int>()
{
6,7,5,5,2,1
};