ImmutableList.ToImmutableList 方法

定义

重载

ToImmutableList<TSource>(IEnumerable<TSource>)

枚举序列,并生成其内容的不可变列表。

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

从生成器集合的当前内容创建不可变列表。

ToImmutableList<TSource>(IEnumerable<TSource>)

Source:
ImmutableList.cs
Source:
ImmutableList.cs
Source:
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)

Source:
ImmutableList.cs
Source:
ImmutableList.cs
Source:
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