Olvasás angol nyelven Szerkesztés

Megosztás a következőn keresztül:


MemoryMarshal.CreateFromPinnedArray<T>(T[], Int32, Int32) Method

Definition

Creates a new memory buffer over the portion of the pre-pinned target array beginning at the start index and consisting of length items.

C#
public static Memory<T> CreateFromPinnedArray<T>(T[]? array, int start, int length);
C#
public static Memory<T> CreateFromPinnedArray<T>(T[] array, int start, int length);

Type Parameters

T

The type of the array.

Parameters

array
T[]

The pre-pinned source array.

start
Int32

The index of array at which to begin the memory block.

length
Int32

The number of items to include in the memory block.

Returns

A block of memory over the specified elements of array. If array is null, or if start and length are 0, the method returns a Memory<T> instance of Length zero.

Exceptions

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

The start or the end index is not in the range of 0 to Length.

Remarks

The array must already be pinned before this method is called, and that array must not be unpinned while the Memory<T> buffer that it returns is still in use. Calling this method on an unpinned array could result in memory corruption.

Applies to

Termék Verziók
.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