ImmutableHashSet<T> ImmutableHashSet<T> ImmutableHashSet<T> ImmutableHashSet<T> Class

Definition

Represents an immutable, unordered hash set.

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

generic <typename T>
public ref class ImmutableHashSet sealed : System::Collections::Generic::ICollection<T>, System::Collections::Generic::IEnumerable<T>, System::Collections::Generic::IReadOnlyCollection<T>, System::Collections::Generic::ISet<T>, System::Collections::ICollection, System::Collections::Immutable::IImmutableSet<T>
public sealed class ImmutableHashSet<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.ISet<T>, System.Collections.ICollection, System.Collections.Immutable.IImmutableSet<T>
type ImmutableHashSet<'T> = class
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
    interface IReadOnlyCollection<'T>
    interface ISet<'T>
    interface ICollection
    interface IImmutableSet<'T>
Public NotInheritable Class ImmutableHashSet(Of T)
Implements ICollection, ICollection(Of T), IEnumerable(Of T), IImmutableSet(Of T), IReadOnlyCollection(Of T), ISet(Of T)

Type Parameters

T

The type of elements in the hash set.

Inheritance
ImmutableHashSet<T>ImmutableHashSet<T>ImmutableHashSet<T>ImmutableHashSet<T>
Implements

Fields

Empty Empty Empty Empty

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

Properties

Count Count Count Count

Gets the number of elements in the immutable hash set.

IsEmpty IsEmpty IsEmpty IsEmpty

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

KeyComparer KeyComparer KeyComparer KeyComparer

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.

Methods

Add(T) Add(T) Add(T) Add(T)

Adds the specified element to the hash set.

Clear() Clear() Clear() Clear()

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

Contains(T) Contains(T) Contains(T) Contains(T)

Determines whether this immutable hash set contains the specified element.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Except(IEnumerable<T>) Except(IEnumerable<T>) Except(IEnumerable<T>) Except(IEnumerable<T>)

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

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that iterates through the collection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
Intersect(IEnumerable<T>) Intersect(IEnumerable<T>) Intersect(IEnumerable<T>) Intersect(IEnumerable<T>)

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

IsProperSubsetOf(IEnumerable<T>) IsProperSubsetOf(IEnumerable<T>) IsProperSubsetOf(IEnumerable<T>) IsProperSubsetOf(IEnumerable<T>)

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

IsProperSupersetOf(IEnumerable<T>) IsProperSupersetOf(IEnumerable<T>) IsProperSupersetOf(IEnumerable<T>) IsProperSupersetOf(IEnumerable<T>)

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

IsSubsetOf(IEnumerable<T>) IsSubsetOf(IEnumerable<T>) IsSubsetOf(IEnumerable<T>) IsSubsetOf(IEnumerable<T>)

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

IsSupersetOf(IEnumerable<T>) IsSupersetOf(IEnumerable<T>) IsSupersetOf(IEnumerable<T>) IsSupersetOf(IEnumerable<T>)

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

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Overlaps(IEnumerable<T>) Overlaps(IEnumerable<T>) Overlaps(IEnumerable<T>) Overlaps(IEnumerable<T>)

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

Remove(T) Remove(T) Remove(T) Remove(T)

Removes the specified element from this immutable hash set.

SetEquals(IEnumerable<T>) SetEquals(IEnumerable<T>) SetEquals(IEnumerable<T>) SetEquals(IEnumerable<T>)

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

SymmetricExcept(IEnumerable<T>) SymmetricExcept(IEnumerable<T>) SymmetricExcept(IEnumerable<T>) SymmetricExcept(IEnumerable<T>)

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.

ToBuilder() ToBuilder() ToBuilder() 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.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)
TryGetValue(T, T) TryGetValue(T, T) TryGetValue(T, T) TryGetValue(T, T)

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

Union(IEnumerable<T>) Union(IEnumerable<T>) Union(IEnumerable<T>) Union(IEnumerable<T>)

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

WithComparer(IEqualityComparer<T>) WithComparer(IEqualityComparer<T>) WithComparer(IEqualityComparer<T>) WithComparer(IEqualityComparer<T>)

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

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

Copies the elements of the set to an array, starting at a particular index.

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

See the ICollection interface.

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

See ICollection.

ICollection<T>.Add(T) ICollection<T>.Add(T) ICollection<T>.Add(T) ICollection<T>.Add(T)

Adds an item to the set.

ICollection<T>.Clear() ICollection<T>.Clear() ICollection<T>.Clear() ICollection<T>.Clear()

Removes all items from this set.

ICollection<T>.CopyTo(T[], Int32) ICollection<T>.CopyTo(T[], Int32) ICollection<T>.CopyTo(T[], Int32) ICollection<T>.CopyTo(T[], Int32)

Copies the elements of the set to an array, starting at a particular index.

ICollection<T>.IsReadOnly ICollection<T>.IsReadOnly ICollection<T>.IsReadOnly ICollection<T>.IsReadOnly

See the ICollection<T> interface.

ICollection<T>.Remove(T) ICollection<T>.Remove(T) ICollection<T>.Remove(T) ICollection<T>.Remove(T)

Removes the first occurrence of a specific object from the set.

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a set.

IEnumerable<T>.GetEnumerator() IEnumerable<T>.GetEnumerator() IEnumerable<T>.GetEnumerator() IEnumerable<T>.GetEnumerator()

Returns an enumerator that iterates through the collection.

IImmutableSet<T>.Add(T) IImmutableSet<T>.Add(T) IImmutableSet<T>.Add(T) IImmutableSet<T>.Add(T)

Adds the specified element to this immutable set.

IImmutableSet<T>.Clear() IImmutableSet<T>.Clear() IImmutableSet<T>.Clear() IImmutableSet<T>.Clear()

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

IImmutableSet<T>.Except(IEnumerable<T>) IImmutableSet<T>.Except(IEnumerable<T>) IImmutableSet<T>.Except(IEnumerable<T>) IImmutableSet<T>.Except(IEnumerable<T>)

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

IImmutableSet<T>.Intersect(IEnumerable<T>) IImmutableSet<T>.Intersect(IEnumerable<T>) IImmutableSet<T>.Intersect(IEnumerable<T>) IImmutableSet<T>.Intersect(IEnumerable<T>)

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

IImmutableSet<T>.Remove(T) IImmutableSet<T>.Remove(T) IImmutableSet<T>.Remove(T) IImmutableSet<T>.Remove(T)

Removes the specified element from this immutable set.

IImmutableSet<T>.SymmetricExcept(IEnumerable<T>) IImmutableSet<T>.SymmetricExcept(IEnumerable<T>) IImmutableSet<T>.SymmetricExcept(IEnumerable<T>) IImmutableSet<T>.SymmetricExcept(IEnumerable<T>)

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

IImmutableSet<T>.Union(IEnumerable<T>) IImmutableSet<T>.Union(IEnumerable<T>) IImmutableSet<T>.Union(IEnumerable<T>) IImmutableSet<T>.Union(IEnumerable<T>)

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

ISet<T>.Add(T) ISet<T>.Add(T) ISet<T>.Add(T) ISet<T>.Add(T)

Adds an element to the current set and returns a value that indicates whether the element was successfully added.

ISet<T>.ExceptWith(IEnumerable<T>) ISet<T>.ExceptWith(IEnumerable<T>) ISet<T>.ExceptWith(IEnumerable<T>) ISet<T>.ExceptWith(IEnumerable<T>)

Removes all elements in the specified collection from the current set.

ISet<T>.IntersectWith(IEnumerable<T>) ISet<T>.IntersectWith(IEnumerable<T>) ISet<T>.IntersectWith(IEnumerable<T>) ISet<T>.IntersectWith(IEnumerable<T>)

Modifies the current set so that it contains only elements that are also in a specified collection.

ISet<T>.SymmetricExceptWith(IEnumerable<T>) ISet<T>.SymmetricExceptWith(IEnumerable<T>) ISet<T>.SymmetricExceptWith(IEnumerable<T>) ISet<T>.SymmetricExceptWith(IEnumerable<T>)

Modifies 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.

ISet<T>.UnionWith(IEnumerable<T>) ISet<T>.UnionWith(IEnumerable<T>) ISet<T>.UnionWith(IEnumerable<T>) ISet<T>.UnionWith(IEnumerable<T>)

Modifies the current set so that it contains all elements that are present in either the current set or in the specified collection.

Extension Methods

CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>)

Returns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>)

Returns a collection of elements that contains the ancestors of every node in the source collection.

Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName)

Returns a filtered collection of elements that contains the ancestors of every node in the source collection. Only elements that have a matching XName are included in the collection.

DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>)

Returns a collection of the descendant nodes of every document and element in the source collection.

Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>)

Returns a collection of elements that contains the descendant elements of every element and document in the source collection.

Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName)

Returns a filtered collection of elements that contains the descendant elements of every element and document in the source collection. Only elements that have a matching XName are included in the collection.

Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>)

Returns a collection of the child elements of every element and document in the source collection.

Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName)

Returns a filtered collection of the child elements of every element and document in the source collection. Only elements that have a matching XName are included in the collection.

InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>)

Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>)

Returns a collection of the child nodes of every document and element in the source collection.

Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>)

Removes every node in the source collection from its parent node.

Applies to

Thread Safety

This type is thread safe.