ReadOnlyMemory<T> Constructors

Definition

Overloads

ReadOnlyMemory<T>(T[])

Creates a new memory region over the entirety of the target array.

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

Creates a new memory region over the portion of the target array beginning at a specified position and including a specified number of elements.

ReadOnlyMemory<T>(T[])

Source:
ReadOnlyMemory.cs
Source:
ReadOnlyMemory.cs
Source:
ReadOnlyMemory.cs

Creates a new memory region over the entirety of the target array.

C#
public ReadOnlyMemory(T[]? array);
C#
public ReadOnlyMemory(T[] array);

Parameters

array
T[]

The target array.

Exceptions

array is covariant, and the type of array is not exactly T[].

Remarks

Returns default when array is null.

Applies to

.NET 10 a ďalšie verzie
Produkt Verzie
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1

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

Source:
ReadOnlyMemory.cs
Source:
ReadOnlyMemory.cs
Source:
ReadOnlyMemory.cs

Creates a new memory region over the portion of the target array beginning at a specified position and including a specified number of elements.

C#
public ReadOnlyMemory(T[]? array, int start, int length);
C#
public ReadOnlyMemory(T[] array, int start, int length);

Parameters

array
T[]

The target array.

start
Int32

The index at which to begin the memory region.

length
Int32

The number of items in the memory region.

Exceptions

array is covariant, and the type of array is not exactly T[].

start, length, or start + length identify a position outside the range of the array.

Remarks

Returns default when array is null.

Applies to

.NET 10 a ďalšie verzie
Produkt Verzie
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1