METHOD

HashSet.ExceptWith

Removes members equal to elements in other, changing the receiver.

Formal Syntax & Structure

csharp syntaxcsharp
void ExceptWith(IEnumerable<T> other)

Working Example

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