ImmutableList.ToImmutableList Method

Definition

Overloads

ToImmutableList<TSource>(IEnumerable<TSource>)

Enumerates a sequence and produces an immutable list of its contents.

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

Creates an immutable list from the current contents of the builder's collection.

ToImmutableList<TSource>(IEnumerable<TSource>)

Source:
ImmutableList.cs
Source:
ImmutableList.cs
Source:
ImmutableList.cs
Source:
ImmutableList.cs

Enumerates a sequence and produces an immutable list of its contents.

C#
public static System.Collections.Immutable.ImmutableList<TSource> ToImmutableList<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

ImmutableList<TSource>

An immutable list 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

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

Source:
ImmutableList.cs
Source:
ImmutableList.cs
Source:
ImmutableList.cs
Source:
ImmutableList.cs

Creates an immutable list from the current contents of the builder's collection.

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

Type Parameters

TSource

The type of the elements in the list.

Parameters

builder
ImmutableList<TSource>.Builder

The builder to create the immutable list from.

Returns

ImmutableList<TSource>

An immutable list that contains the current contents in the builder's collection.

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)