Читати англійською Редагувати

Поділитися через


ImmutableArray.Create Method

Definition

Overloads

Create<T>(T, T, T, T)

Creates an immutable array that contains the specified objects.

Create<T>(T, T, T)

Creates an immutable array that contains the specified objects.

Create<T>(ImmutableArray<T>, Int32, Int32)

Creates an immutable array with the specified objects from another immutable array.

Create<T>(T, T)

Creates an immutable array that contains the specified objects.

Create<T>(T[], Int32, Int32)

Creates an immutable array with specified objects from another array.

Create<T>(T)

Creates an immutable array that contains the specified object.

Create<T>(Span<T>)

Creates an ImmutableArray<T> with the specified elements.

Create<T>(ReadOnlySpan<T>)

Creates an ImmutableArray<T> with the specified elements.

Create<T>()

Creates an empty immutable array.

Create<T>(T[])

Creates an immutable array from the specified array of objects.

Create<T>(T, T, T, T)

Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs

Creates an immutable array that contains the specified objects.

C#
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(T item1, T item2, T item3, T item4);

Type Parameters

T

The type of elements stored in the array.

Parameters

item1
T

The first object to store in the array.

item2
T

The second object to store in the array.

item3
T

The third object to store in the array.

item4
T

The fourth object to store in the array.

Returns

An immutable array that contains the specified objects.

Applies to

.NET 10 та інші версії
Продукт Версії
.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, T, T)

Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs

Creates an immutable array that contains the specified objects.

C#
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(T item1, T item2, T item3);

Type Parameters

T

The type of elements stored in the array.

Parameters

item1
T

The first object to store in the array.

item2
T

The second object to store in the array.

item3
T

The third object to store in the array.

Returns

An immutable array that contains the specified objects.

Applies to

.NET 10 та інші версії
Продукт Версії
.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>(ImmutableArray<T>, Int32, Int32)

Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs

Creates an immutable array with the specified objects from another immutable array.

C#
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(System.Collections.Immutable.ImmutableArray<T> items, int start, int length);

Type Parameters

T

The type of elements stored in the array.

Parameters

items
ImmutableArray<T>

The source array of objects.

start
Int32

The index of the first element to copy from items.

length
Int32

The number of elements from items to include in this immutable array.

Returns

An immutable array that contains the specified objects from the source array.

Remarks

This overload allows helper methods or custom builder classes to efficiently avoid paying a redundant tax for copying an array when the new array is a segment of an existing array.

Applies to

.NET 10 та інші версії
Продукт Версії
.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, T)

Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs

Creates an immutable array that contains the specified objects.

C#
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(T item1, T item2);

Type Parameters

T

The type of elements stored in the array.

Parameters

item1
T

The first object to store in the array.

item2
T

The second object to store in the array.

Returns

An immutable array that contains the specified objects.

Applies to

.NET 10 та інші версії
Продукт Версії
.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[], Int32, Int32)

Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs

Creates an immutable array with specified objects from another array.

C#
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(T[] items, int start, int length);

Type Parameters

T

The type of elements stored in the array.

Parameters

items
T[]

The source array of objects.

start
Int32

The index of the first element to copy from items.

length
Int32

The number of elements from items to include in this immutable array.

Returns

An immutable array that contains the specified objects from the source array.

Remarks

This overload allows helper methods or custom builder classes to efficiently avoid paying a redundant tax for copying an array when the new array is a segment of an existing array.

Applies to

.NET 10 та інші версії
Продукт Версії
.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:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs

Creates an immutable array that contains the specified object.

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

Type Parameters

T

The type of elements stored in the array.

Parameters

item
T

The object to store in the array.

Returns

An immutable array that contains the specified object.

Applies to

.NET 10 та інші версії
Продукт Версії
.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>(Span<T>)

Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs

Creates an ImmutableArray<T> with the specified elements.

C#
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(Span<T> items);
C#
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(Span<T> items);

Type Parameters

T

The type of element stored in the array.

Parameters

items
Span<T>

The elements to store in the array.

Returns

An immutable array containing the specified items.

Attributes

Applies to

.NET 10 та інші версії
Продукт Версії
.NET 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)

Create<T>(ReadOnlySpan<T>)

Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs

Creates an ImmutableArray<T> with the specified elements.

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

Type Parameters

T

The type of element stored in the array.

Parameters

items
ReadOnlySpan<T>

The elements to store in the array.

Returns

An immutable array containing the specified items.

Applies to

.NET 10 та інші версії
Продукт Версії
.NET 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)

Create<T>()

Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs

Creates an empty immutable array.

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

Type Parameters

T

The type of elements stored in the array.

Returns

An empty immutable array.

Applies to

.NET 10 та інші версії
Продукт Версії
.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:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs
Source:
ImmutableArray.cs

Creates an immutable array from the specified array of objects.

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

Type Parameters

T

The type of elements stored in the array.

Parameters

items
T[]

The array of objects to populate the array with.

Returns

An immutable array that contains the array of items.

Applies to

.NET 10 та інші версії
Продукт Версії
.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