MemoryMarshal.GetArrayDataReference<T>(T[]) 方法

定义

返回对 array 中第 0 个元素的引用。Returns a reference to the 0th element of array. 如果数组为空,则返回对要存储第 0 个元素的位置的引用。If the array is empty, returns a reference to where the 0th element would have been stored. 此类引用可用于固定,但绝不能取消引用。Such a reference may be used for pinning but must never be dereferenced.

public:
generic <typename T>
 static T % GetArrayDataReference(cli::array <T> ^ array);
public static ref T GetArrayDataReference<T> (T[] array);
static member GetArrayDataReference : 'T[] -> 'T
Public Shared Function GetArrayDataReference(Of T) (array As T()) As T

类型参数

T

数组元素的类型。The type of the array elements.

参数

array
T[]

要分析的数组。The array to analyze.

返回

T

array 中第 0 个元素的引用Reference to the 0th element in array

例外

arraynullarray is null.

注解

此方法不执行数组方差检查。This method does not perform array variance checks. 如果调用方希望写入返回的引用,则调用方必须手动执行任何数组方差检查。The caller must manually perform any array variance checks if the caller wishes to write to the returned reference.

适用于