Edit

Share via


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

Creates an immutable array that contains the specified objects.

public:
generic <typename T>
 static System::Collections::Immutable::ImmutableArray<T> Create(T item1, T item2, T item3, T item4);
public static System.Collections.Immutable.ImmutableArray<T> Create<T> (T item1, T item2, T item3, T item4);
static member Create : 'T * 'T * 'T * 'T -> System.Collections.Immutable.ImmutableArray<'T>
Public Function Create(Of T) (item1 As T, item2 As T, item3 As T, item4 As T) As ImmutableArray(Of T)

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

Create<T>(T, T, T)

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

Creates an immutable array that contains the specified objects.

public:
generic <typename T>
 static System::Collections::Immutable::ImmutableArray<T> Create(T item1, T item2, T item3);
public static System.Collections.Immutable.ImmutableArray<T> Create<T> (T item1, T item2, T item3);
static member Create : 'T * 'T * 'T -> System.Collections.Immutable.ImmutableArray<'T>
Public Function Create(Of T) (item1 As T, item2 As T, item3 As T) As ImmutableArray(Of T)

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

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

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

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

public:
generic <typename T>
 static System::Collections::Immutable::ImmutableArray<T> Create(System::Collections::Immutable::ImmutableArray<T> items, int start, int length);
public static System.Collections.Immutable.ImmutableArray<T> Create<T> (System.Collections.Immutable.ImmutableArray<T> items, int start, int length);
static member Create : System.Collections.Immutable.ImmutableArray<'T> * int * int -> System.Collections.Immutable.ImmutableArray<'T>
Public Function Create(Of T) (items As ImmutableArray(Of T), start As Integer, length As Integer) As ImmutableArray(Of T)

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

Create<T>(T, T)

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

Creates an immutable array that contains the specified objects.

public:
generic <typename T>
 static System::Collections::Immutable::ImmutableArray<T> Create(T item1, T item2);
public static System.Collections.Immutable.ImmutableArray<T> Create<T> (T item1, T item2);
static member Create : 'T * 'T -> System.Collections.Immutable.ImmutableArray<'T>
Public Function Create(Of T) (item1 As T, item2 As T) As ImmutableArray(Of T)

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

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

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

Creates an immutable array with specified objects from another array.

public:
generic <typename T>
 static System::Collections::Immutable::ImmutableArray<T> Create(cli::array <T> ^ items, int start, int length);
public static System.Collections.Immutable.ImmutableArray<T> Create<T> (T[] items, int start, int length);
static member Create : 'T[] * int * int -> System.Collections.Immutable.ImmutableArray<'T>
Public Function Create(Of T) (items As T(), start As Integer, length As Integer) As ImmutableArray(Of T)

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

Create<T>(T)

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

Creates an immutable array that contains the specified object.

public:
generic <typename T>
 static System::Collections::Immutable::ImmutableArray<T> Create(T item);
public static System.Collections.Immutable.ImmutableArray<T> Create<T> (T item);
static member Create : 'T -> System.Collections.Immutable.ImmutableArray<'T>
Public Function Create(Of T) (item As T) As ImmutableArray(Of T)

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

Create<T>(Span<T>)

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

Creates an ImmutableArray<T> with the specified elements.

public:
generic <typename T>
 static System::Collections::Immutable::ImmutableArray<T> Create(Span<T> items);
public static System.Collections.Immutable.ImmutableArray<T> Create<T> (Span<T> items);
static member Create : Span<'T> -> System.Collections.Immutable.ImmutableArray<'T>
Public Function Create(Of T) (items As Span(Of T)) As ImmutableArray(Of T)

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.

Applies to

Create<T>(ReadOnlySpan<T>)

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

Creates an ImmutableArray<T> with the specified elements.

public:
generic <typename T>
 static System::Collections::Immutable::ImmutableArray<T> Create(ReadOnlySpan<T> items);
public static System.Collections.Immutable.ImmutableArray<T> Create<T> (ReadOnlySpan<T> items);
public static System.Collections.Immutable.ImmutableArray<T> Create<T> (scoped ReadOnlySpan<T> items);
static member Create : ReadOnlySpan<'T> -> System.Collections.Immutable.ImmutableArray<'T>
Public Function Create(Of T) (items As ReadOnlySpan(Of T)) As ImmutableArray(Of T)

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

Create<T>()

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

Creates an empty immutable array.

public:
generic <typename T>
 static System::Collections::Immutable::ImmutableArray<T> Create();
public static System.Collections.Immutable.ImmutableArray<T> Create<T> ();
static member Create : unit -> System.Collections.Immutable.ImmutableArray<'T>
Public Function Create(Of T) () As ImmutableArray(Of T)

Type Parameters

T

The type of elements stored in the array.

Returns

An empty immutable array.

Applies to

Create<T>(T[])

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

Creates an immutable array from the specified array of objects.

public:
generic <typename T>
 static System::Collections::Immutable::ImmutableArray<T> Create(... cli::array <T> ^ items);
public static System.Collections.Immutable.ImmutableArray<T> Create<T> (params T[] items);
public static System.Collections.Immutable.ImmutableArray<T> Create<T> (params T[]? items);
static member Create : 'T[] -> System.Collections.Immutable.ImmutableArray<'T>
Public Function Create(Of T) (ParamArray items As T()) As ImmutableArray(Of T)

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