ImmutableList.ToImmutableList 方法

定義

多載

ToImmutableList<TSource>(IEnumerable<TSource>)

列舉序列,並產生其內容的不可變清單。

ToImmutableList<TSource>(ImmutableList<TSource>.Builder)

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

ToImmutableList<TSource>(IEnumerable<TSource>)

來源:
ImmutableList.cs
來源:
ImmutableList.cs
來源:
ImmutableList.cs

列舉序列,並產生其內容的不可變清單。

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

類型參數

TSource

序列中的項目類型。

參數

source
IEnumerable<TSource>

要列舉的序列。

傳回

ImmutableList<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

ToImmutableList<TSource>(ImmutableList<TSource>.Builder)

來源:
ImmutableList.cs
來源:
ImmutableList.cs
來源:
ImmutableList.cs

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

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

類型參數

TSource

清單中元素的類型。

參數

builder
ImmutableList<TSource>.Builder

用於建立不可變清單的產生器。

傳回

ImmutableList<TSource>

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

適用於

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