ImmutableHashSet.ToImmutableHashSet 方法

定義

多載

ToImmutableHashSet<TSource>(IEnumerable<TSource>)

列舉序列,並產生其內容之不可變雜湊集。

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

從產生器集合目前內容建立不可變的雜湊集。

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

列舉序列、產生其內容之不可變雜湊集,且針對集合類型使用指定的相等比較子。

ToImmutableHashSet<TSource>(IEnumerable<TSource>)

來源:
ImmutableHashSet.cs
來源:
ImmutableHashSet.cs
來源:
ImmutableHashSet.cs

列舉序列,並產生其內容之不可變雜湊集。

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

類型參數

TSource

序列中的項目類型。

參數

source
IEnumerable<TSource>

要列舉的序列。

傳回

ImmutableHashSet<TSource>

不可變雜湊集,其中包含指定序列中的項目。

適用於

.NET 9 和其他版本
產品 版本
.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, 9
UWP 10.0

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

來源:
ImmutableHashSet.cs
來源:
ImmutableHashSet.cs
來源:
ImmutableHashSet.cs

從產生器集合目前內容建立不可變的雜湊集。

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

類型參數

TSource

哈希集中專案的型別。

參數

builder
ImmutableHashSet<TSource>.Builder

產生器,用於建立不可變的雜湊集。

傳回

ImmutableHashSet<TSource>

不可變的雜湊集,其中包含產生器集合中的目前內容。

適用於

.NET 9 和其他版本
產品 版本
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9

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

來源:
ImmutableHashSet.cs
來源:
ImmutableHashSet.cs
來源:
ImmutableHashSet.cs

列舉序列、產生其內容之不可變雜湊集,且針對集合類型使用指定的相等比較子。

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);

類型參數

TSource

序列中的項目類型。

參數

source
IEnumerable<TSource>

要列舉的序列。

equalityComparer
IEqualityComparer<TSource>

比較集合中物件相等所使用的物件。

傳回

ImmutableHashSet<TSource>

不可變雜湊集,其中包含指定序列中的項目,且使用指定的相等比較子。

適用於

.NET 9 和其他版本
產品 版本
.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, 9
UWP 10.0