Edit

Share via


Memory<T> Constructors

Definition

Overloads

Memory<T>(T[])

Creates a new Memory<T> object over the entirety of a specified array.

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

Creates a new Memory<T> object that includes a specified number of elements of an array beginning at a specified index.

Memory<T>(T[])

Source:
Memory.cs
Source:
Memory.cs
Source:
Memory.cs

Creates a new Memory<T> object over the entirety of a specified array.

public:
 Memory(cli::array <T> ^ array);
public Memory (T[]? array);
public Memory (T[] array);
new Memory<'T> : 'T[] -> Memory<'T>
Public Sub New (array As T())

Parameters

array
T[]

The array from which to create the Memory<T> object.

Exceptions

T is a reference type, and array is not an array of type T.

-or-

The array is covariant.

Remarks

If array is null, this constructor returns a Memory<T> object with a default<T> value.

Applies to

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

Source:
Memory.cs
Source:
Memory.cs
Source:
Memory.cs

Creates a new Memory<T> object that includes a specified number of elements of an array beginning at a specified index.

public:
 Memory(cli::array <T> ^ array, int start, int length);
public Memory (T[]? array, int start, int length);
public Memory (T[] array, int start, int length);
new Memory<'T> : 'T[] * int * int -> Memory<'T>
Public Sub New (array As T(), start As Integer, length As Integer)

Parameters

array
T[]

The source array.

start
Int32

The index of the first element to include in the new Memory<T>.

length
Int32

The number of elements to include in the new Memory<T>.

Exceptions

array is null, but start or length is non-zero.

-or-

start is outside the bounds of the array.

-or-

start and length exceeds the number of elements in the array.

T is a reference type, and array is not an array of type T.

Remarks

If array is null, this constructor returns a Memory<T> object with a default<T> value.

Applies to