METHOD

HashSet.SetEquals

Tests membership equality under the set comparer without requiring sequence order or duplicate counts.

Formal Syntax & Structure

csharp syntaxcsharp
bool SetEquals(IEnumerable<T> other)

Working Example

Example Snippetcsharp
using System.Collections.Generic;var ids = new HashSet<int> { 1, 2 };System.Console.WriteLine(ids.SetEquals(new[] { 2, 1, 1 }));
C# & .NET Reference