Export (0) Print
Expand All

ImmutableHashSet<T> Class

Represents an immutable, unordered hash set.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

System.Object
  System.Collections.Immutable.ImmutableHashSet<T>

Namespace:  System.Collections.Immutable
Assembly:  System.Collections.Immutable (in System.Collections.Immutable.dll)

public sealed class ImmutableHashSet<T> : IImmutableSet<T>, 
	IReadOnlyCollection<T>, ISet<T>, ICollection<T>, IEnumerable<T>, 
	ICollection, IEnumerable

Type Parameters

T

The type of elements in the hash set.

The ImmutableHashSet<T> type exposes the following members.

  NameDescription
Public propertyCountGets the number of elements in the immutable hash set.
Public propertyIsEmptyGets a value that indicates whether the current immutable hash set is empty.
Public propertyKeyComparerGets the object that is used to obtain hash codes for the keys and to check the equality of values in the immutable hash set.
Top

  NameDescription
Public methodAddAdds the specified element to the hash set.
Public methodClearRetrieves an empty immutable hash set that has the same sorting and ordering semantics as this instance.
Public methodContainsDetermines whether this immutable hash set contains the specified element.
Public methodEqualsDetermines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodExceptRemoves the elements in the specified collection from the current immutable hash set.
Public methodGetEnumeratorReturns an enumerator that iterates through the collection.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIntersectCreates an immutable hash set that contains elements that exist in both this set and the specified set.
Public methodIsProperSubsetOfDetermines whether the current immutable hash set is a proper (strict) subset of a specified collection.
Public methodIsProperSupersetOfDetermines whether the current immutable hash set is a proper (strict) superset of a specified collection.
Public methodIsSubsetOfDetermines whether the current immutable hash set is a subset of a specified collection.
Public methodIsSupersetOfDetermines whether the current immutable hash set is a superset of a specified collection.
Public methodOverlapsDetermines whether the current immutable hash set overlaps with the specified collection.
Public methodRemoveRemoves the specified element from this immutable hash set.
Public methodSetEqualsDetermines whether the current immutable hash set and the specified collection contain the same elements.
Public methodSymmetricExceptCreates 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 methodToBuilderCreates 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 methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodTryGetValueSearches the set for a given value and returns the equal value it finds, if any.
Public methodUnionCreates a new immutable hash set that contains all elements that are present in either the current set or in the specified collection.
Public methodWithComparerGets an instance of the immutable hash set that uses the specified equality comparer for its search methods.
Top

  NameDescription
Public Extension MethodToImmutableArray<T> [This topic is preliminary and is subject to change.]
Creates an immutable array from the specified collection.
(Defined by ImmutableArray.)
Public Extension MethodToImmutableDictionary<T, TKey>(Func<T, TKey>)Overloaded. Constructs an immutable dictionary from an existing collection of elements, applying a transformation function to the source keys. (Defined by ImmutableDictionary.)
Public Extension MethodToImmutableDictionary<T, TKey>(Func<T, TKey>, IEqualityComparer<TKey>)Overloaded. Constructs an immutable dictionary based on some transformation of a sequence. (Defined by ImmutableDictionary.)
Public Extension MethodToImmutableDictionary<T, TKey, TValue>(Func<T, TKey>, Func<T, TValue>)Overloaded. Enumerates and transforms a sequence, and produces an immutable dictionary of its contents. (Defined by ImmutableDictionary.)
Public Extension MethodToImmutableDictionary<T, TKey, TValue>(Func<T, TKey>, Func<T, TValue>, IEqualityComparer<TKey>)Overloaded. Enumerates and transforms a sequence, and produces an immutable dictionary of its contents by using the specified key comparer. (Defined by ImmutableDictionary.)
Public Extension MethodToImmutableDictionary<T, TKey, TValue>(Func<T, TKey>, Func<T, TValue>, IEqualityComparer<TKey>, IEqualityComparer<TValue>)Overloaded. Enumerates and transforms a sequence, and produces an immutable dictionary of its contents by using the specified key and value comparers. (Defined by ImmutableDictionary.)
Public Extension MethodToImmutableHashSet<T>()Overloaded. Enumerates a sequence and produces an immutable hash set of its contents. (Defined by ImmutableHashSet.)
Public Extension MethodToImmutableHashSet<T>(IEqualityComparer<T>)Overloaded. Enumerates a sequence, produces an immutable hash set of its contents, and uses the specified equality comparer for the set type. (Defined by ImmutableHashSet.)
Public Extension MethodToImmutableList<T>Enumerates a sequence and produces an immutable list of its contents. (Defined by ImmutableList.)
Public Extension MethodToImmutableSortedDictionary<T, TKey, TValue>(Func<T, TKey>, Func<T, TValue>)Overloaded. Enumerates and transforms a sequence, and produces an immutable sorted dictionary of its contents. (Defined by ImmutableSortedDictionary.)
Public Extension MethodToImmutableSortedDictionary<T, TKey, TValue>(Func<T, TKey>, Func<T, TValue>, IComparer<TKey>)Overloaded. Enumerates and transforms a sequence, and produces an immutable sorted dictionary of its contents by using the specified key comparer. (Defined by ImmutableSortedDictionary.)
Public Extension MethodToImmutableSortedDictionary<T, TKey, TValue>(Func<T, TKey>, Func<T, TValue>, IComparer<TKey>, IEqualityComparer<TValue>)Overloaded. Enumerates and transforms a sequence, and produces an immutable sorted dictionary of its contents by using the specified key and value comparers. (Defined by ImmutableSortedDictionary.)
Public Extension MethodToImmutableSortedSet<T>()Overloaded. Enumerates a sequence and produces an immutable sorted set of its contents. (Defined by ImmutableSortedSet.)
Public Extension MethodToImmutableSortedSet<T>(IComparer<T>)Overloaded. Enumerates a sequence, produces an immutable sorted set of its contents, and uses the specified comparer. (Defined by ImmutableSortedSet.)
Top

  NameDescription
Public fieldStatic memberEmptyGets an immutable hash set for this type that uses the default IEqualityComparer<T>.
Top

  NameDescription
Explicit interface implemetationPrivate methodICollection<T>.AddAdds an item to the set.
Explicit interface implemetationPrivate methodISet<T>.AddAdds an element to the current set and returns a value that indicates whether the element was successfully added.
Explicit interface implemetationPrivate methodICollection<T>.ClearRemoves all items from this set.
Explicit interface implemetationPrivate methodICollection<T>.CopyToCopies the elements of the set to an array, starting at a particular index.
Explicit interface implemetationPrivate methodICollection.CopyToCopies the elements of the set to an array, starting at a particular index.
Explicit interface implemetationPrivate methodISet<T>.ExceptWithRemoves all elements in the specified collection from the current set.
Explicit interface implemetationPrivate methodIEnumerable<T>.GetEnumeratorReturns an enumerator that iterates through the collection.
Explicit interface implemetationPrivate methodIEnumerable.GetEnumeratorReturns an enumerator that iterates through a set.
Explicit interface implemetationPrivate methodISet<T>.IntersectWithModifies the current set so that it contains only elements that are also in a specified collection.
Explicit interface implemetationPrivate propertyICollection<T>.IsReadOnlyGets a value that indicates whether the set is read-only.
Explicit interface implemetationPrivate propertyICollection.IsSynchronizedGets a value that indicates whether access to the set is synchronized (thread safe).
Explicit interface implemetationPrivate methodICollection<T>.RemoveRemoves the first occurrence of a specific object from the set.
Explicit interface implemetationPrivate methodISet<T>.SymmetricExceptWithModifies the current set so that it contains only elements that are present either in the current set or in the specified collection, but not both.
Explicit interface implemetationPrivate propertyICollection.SyncRootGets an object that can be used to synchronize access to the set.
Explicit interface implemetationPrivate methodISet<T>.UnionWithModifies the current set so that it contains all elements that are present in either the current set or in the specified collection.
Explicit interface implemetationPrivate methodIImmutableSet<T>.AddAdds the specified element to this immutable set.
Explicit interface implemetationPrivate methodIImmutableSet<T>.ClearRetrieves an empty set that has the same sorting and ordering semantics as this instance.
Explicit interface implemetationPrivate methodIImmutableSet<T>.ExceptRemoves the elements in the specified collection from the current set.
Explicit interface implemetationPrivate methodIImmutableSet<T>.IntersectCreates an immutable set that contains elements that exist in both this set and the specified set.
Explicit interface implemetationPrivate methodIImmutableSet<T>.RemoveRemoves the specified element from this immutable set.
Explicit interface implemetationPrivate methodIImmutableSet<T>.SymmetricExceptCreates an immutable set that contains only elements that are present either in the current set or in the specified collection, but not both.
Explicit interface implemetationPrivate methodIImmutableSet<T>.UnionCreates a new immutable set that contains all elements that are present in either the current set or in the specified collection.
Top

This type is thread safe.

Show:
© 2015 Microsoft