TYPE

HashSet<T>

Unordered set of unique members using the selected equality comparer.

Formal Syntax & Structure

csharp syntaxcsharp
new HashSet<T>(comparer)

Working Example

Example Snippetcsharp
using System.Collections.Generic;var ids = new HashSet<int> { 3, 3, 4 };System.Console.WriteLine(ids.Count);
C# & .NET Reference