ImmutableHashSet.ToImmutableHashSet Method

Definition

Overloads

ToImmutableHashSet<TSource>(IEnumerable<TSource>)

Enumerates a sequence and produces an immutable hash set of its contents.

ToImmutableHashSet<TSource>(ImmutableHashSet<TSource>.Builder)

Creates an immutable hash set from the current contents of the builder's set.

ToImmutableHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)

Enumerates a sequence, produces an immutable hash set of its contents, and uses the specified equality comparer for the set type.

ToImmutableHashSet<TSource>(IEnumerable<TSource>)

Source:
ImmutableHashSet.cs
Source:
ImmutableHashSet.cs
Source:
ImmutableHashSet.cs
Source:
ImmutableHashSet.cs

Enumerates a sequence and produces an immutable hash set of its contents.

C#
public static System.Collections.Immutable.ImmutableHashSet<TSource> ToImmutableHashSet<TSource>(this System.Collections.Generic.IEnumerable<TSource> source);

Type Parameters

TSource

The type of the elements in the sequence.

Parameters

source
IEnumerable<TSource>

The sequence to enumerate.

Returns

ImmutableHashSet<TSource>

An immutable hash set that contains the items in the specified sequence.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0

ToImmutableHashSet<TSource>(ImmutableHashSet<TSource>.Builder)

Source:
ImmutableHashSet.cs
Source:
ImmutableHashSet.cs
Source:
ImmutableHashSet.cs
Source:
ImmutableHashSet.cs

Creates an immutable hash set from the current contents of the builder's set.

C#
public static System.Collections.Immutable.ImmutableHashSet<TSource> ToImmutableHashSet<TSource>(this System.Collections.Immutable.ImmutableHashSet<TSource>.Builder builder);

Type Parameters

TSource

The type of the elements in the hash set.

Parameters

builder
ImmutableHashSet<TSource>.Builder

The builder to create the immutable hash set from.

Returns

ImmutableHashSet<TSource>

An immutable hash set that contains the current contents in the builder's set.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)

ToImmutableHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)

Source:
ImmutableHashSet.cs
Source:
ImmutableHashSet.cs
Source:
ImmutableHashSet.cs
Source:
ImmutableHashSet.cs

Enumerates a sequence, produces an immutable hash set of its contents, and uses the specified equality comparer for the set type.

C#
public static System.Collections.Immutable.ImmutableHashSet<TSource> ToImmutableHashSet<TSource>(this System.Collections.Generic.IEnumerable<TSource> source, System.Collections.Generic.IEqualityComparer<TSource> equalityComparer);
C#
public static System.Collections.Immutable.ImmutableHashSet<TSource> ToImmutableHashSet<TSource>(this System.Collections.Generic.IEnumerable<TSource> source, System.Collections.Generic.IEqualityComparer<TSource>? equalityComparer);

Type Parameters

TSource

The type of the elements in the sequence.

Parameters

source
IEnumerable<TSource>

The sequence to enumerate.

equalityComparer
IEqualityComparer<TSource>

The object to use for comparing objects in the set for equality.

Returns

ImmutableHashSet<TSource>

An immutable hash set that contains the items in the specified sequence and uses the specified equality comparer.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0