ImmutableList.Create Method

Definition

Overloads

Create<T>()

Creates an empty immutable list.

Create<T>(ReadOnlySpan<T>)

Creates a new immutable list that contains the items from the specified span of items.

Create<T>(T)

Creates a new immutable list that contains the specified item.

Create<T>(T[])

Creates a new immutable list that contains the specified array of items.

Create<T>()

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

Creates an empty immutable list.

C#
public static System.Collections.Immutable.ImmutableList<T> Create<T>();

Type Parameters

T

The type of items to be stored in the .

Returns

An empty immutable list.

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

Create<T>(ReadOnlySpan<T>)

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

Creates a new immutable list that contains the items from the specified span of items.

C#
public static System.Collections.Immutable.ImmutableList<T> Create<T>(scoped ReadOnlySpan<T> items);
C#
public static System.Collections.Immutable.ImmutableList<T> Create<T>(ReadOnlySpan<T> items);

Type Parameters

T

The type of items stored by the collection.

Parameters

items
ReadOnlySpan<T>

A span that contains the items to prepopulate the list with.

Returns

A new immutable list that contains the specified items.

Applies to

.NET 10 and other versions
Product Versions
.NET 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)

Create<T>(T)

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

Creates a new immutable list that contains the specified item.

C#
public static System.Collections.Immutable.ImmutableList<T> Create<T>(T item);

Type Parameters

T

The type of items in the .

Parameters

item
T

The item to prepopulate the list with.

Returns

A new that contains the specified item.

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

Create<T>(T[])

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

Creates a new immutable list that contains the specified array of items.

C#
public static System.Collections.Immutable.ImmutableList<T> Create<T>(params T[] items);

Type Parameters

T

The type of items in the .

Parameters

items
T[]

An array that contains the items to prepopulate the list with.

Returns

A new immutable list that contains the specified items.

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