System.Collections.Immutable by Microsoft

<PackageReference Include="System.Collections.Immutable" Version="8.0.0-preview.3.23174.8" />

.NET API 250,032 bytes

 ImmutableHashSet<T>

Represents an immutable, unordered hash set. NuGet package: System.Collections.Immutable (about immutable collections and how to install)
public sealed class Builder<T> : IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable, ISet<T>, ICollection<T>

Represents a hash set that mutates with little or no memory allocations and that can produce or build on immutable hash set instances very efficiently. NuGet package: System.Collections.Immutable (about immutable collections and how to install)

Enumerates the contents of the immutable hash set without allocating any memory. NuGet package: System.Collections.Immutable (about immutable collections and how to install)

public static readonly ImmutableHashSet<T> Empty

Gets an immutable hash set for this type that uses the default IEqualityComparer<T>.

public int Count { get; }

Gets the number of elements in the immutable hash set.

public bool IsEmpty { get; }

Gets a value that indicates whether the current immutable hash set is empty.

public IEqualityComparer<T> KeyComparer { get; }

Gets the object that is used to obtain hash codes for the keys and to check the equality of values in the immutable hash set.

public ImmutableHashSet<T> Add(T item)

Adds the specified element to the hash set.

public ImmutableHashSet<T> Clear()

Retrieves an empty immutable hash set that has the same sorting and ordering semantics as this instance.

public bool Contains(T item)

Determines whether this immutable hash set contains the specified element.

public ImmutableHashSet<T> Except(IEnumerable<T> other)

Removes the elements in the specified collection from the current immutable hash set.

Returns an enumerator that iterates through the collection.

Creates an immutable hash set that contains elements that exist in both this set and the specified set.

public bool IsProperSubsetOf(IEnumerable<T> other)

Determines whether the current immutable hash set is a proper (strict) subset of a specified collection.

public bool IsProperSupersetOf(IEnumerable<T> other)

Determines whether the current immutable hash set is a proper (strict) superset of a specified collection.

public bool IsSubsetOf(IEnumerable<T> other)

Determines whether the current immutable hash set is a subset of a specified collection.

public bool IsSupersetOf(IEnumerable<T> other)

Determines whether the current immutable hash set is a superset of a specified collection.

public bool Overlaps(IEnumerable<T> other)

Determines whether the current immutable hash set overlaps with the specified collection.

public ImmutableHashSet<T> Remove(T item)

Removes the specified element from this immutable hash set.

public bool SetEquals(IEnumerable<T> other)

Determines whether the current immutable hash set and the specified collection contain the same elements.

Creates an immutable hash set that contains only elements that are present either in the current set or in the specified collection, but not both.

public Builder<T> ToBuilder()

Creates an immutable hash set that has the same contents as this set and can be efficiently mutated across multiple operations by using standard mutable interfaces.

public bool TryGetValue(T equalValue, out T actualValue)

Searches the set for a given value and returns the equal value it finds, if any.

public ImmutableHashSet<T> Union(IEnumerable<T> other)

Creates a new immutable hash set that contains all elements that are present in either the current set or in the specified collection.

public ImmutableHashSet<T> WithComparer(IEqualityComparer<T> equalityComparer)

Gets an instance of the immutable hash set that uses the specified equality comparer for its search methods.