Ανάγνωση στα Αγγλικά Επεξεργασία

Κοινή χρήση μέσω


Memory<T> Constructors

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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(T[]? array);
public Memory(T[] array);

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

.NET 10 και άλλες εκδόσεις
Προϊόν Εκδόσεις
.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

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(T[]? array, int start, int length);
public Memory(T[] array, int start, int length);

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

.NET 10 και άλλες εκδόσεις
Προϊόν Εκδόσεις
.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