Method GetArrayDataReference
GetArrayDataReference<T>(T[])
Returns a reference to the 0th element of array
. If the array is empty, returns a null reference. Such a reference may be used for pinning but must never be dereferenced (返回对 array 中第 0 个元素的引用。 如果数组为空,则返回对 null 引用。 此类引用可用于固定,但绝不能取消引用).
public static ref T GetArrayDataReference<T>(T[] array)
Parameters
array
T[]
Returns
- T
Type Parameters
T
Remarks
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 (此方法不执行数组差异检查。 如果调用方希望写入返回的引用,则调用方必须手动执行任何数组差异检查).