Marshal.UnsafeAddrOfPinnedArrayElement 方法

定義

多載

UnsafeAddrOfPinnedArrayElement(Array, Int32)
已淘汰.

取得指定陣列內指定索引處的元素的位址。

UnsafeAddrOfPinnedArrayElement<T>(T[], Int32)

在指定類型的陣列中取得位於指定索引處的元素的位址。

UnsafeAddrOfPinnedArrayElement(Array, Int32)

來源:
Marshal.cs
來源:
Marshal.cs
來源:
Marshal.cs

警告

UnsafeAddrOfPinnedArrayElement(Array, Int32) may be unavailable in future releases. Instead, use UnsafeAddrOfPinnedArrayElement<T>(T[], Int32). For more info, go to http://go.microsoft.com/fwlink/?LinkID=296517

取得指定陣列內指定索引處的元素的位址。

public:
 static IntPtr UnsafeAddrOfPinnedArrayElement(Array ^ arr, int index);
[System.Obsolete("UnsafeAddrOfPinnedArrayElement(Array, Int32) may be unavailable in future releases. Instead, use UnsafeAddrOfPinnedArrayElement<T>(T[], Int32). For more info, go to http://go.microsoft.com/fwlink/?LinkID=296517")]
[System.Security.SecurityCritical]
public static IntPtr UnsafeAddrOfPinnedArrayElement (Array arr, int index);
public static IntPtr UnsafeAddrOfPinnedArrayElement (Array arr, int index);
[System.Security.SecurityCritical]
public static IntPtr UnsafeAddrOfPinnedArrayElement (Array arr, int index);
[<System.Obsolete("UnsafeAddrOfPinnedArrayElement(Array, Int32) may be unavailable in future releases. Instead, use UnsafeAddrOfPinnedArrayElement<T>(T[], Int32). For more info, go to http://go.microsoft.com/fwlink/?LinkID=296517")>]
[<System.Security.SecurityCritical>]
static member UnsafeAddrOfPinnedArrayElement : Array * int -> nativeint
static member UnsafeAddrOfPinnedArrayElement : Array * int -> nativeint
[<System.Security.SecurityCritical>]
static member UnsafeAddrOfPinnedArrayElement : Array * int -> nativeint
Public Shared Function UnsafeAddrOfPinnedArrayElement (arr As Array, index As Integer) As IntPtr

參數

arr
Array

包含所需元素的陣列。

index
Int32

希望的元素之 arr 參數中的索引。

傳回

IntPtr

nativeint

index 內部的 arr 位址。

屬性

備註

必須先使用 GCHandle 來釘選陣列,才能將其傳遞至這個方法。 為了達到最大效能,這個方法不會驗證傳遞給它的陣列;這可能會導致非預期的行為。

另請參閱

適用於

UnsafeAddrOfPinnedArrayElement<T>(T[], Int32)

來源:
Marshal.cs
來源:
Marshal.cs
來源:
Marshal.cs

在指定類型的陣列中取得位於指定索引處的元素的位址。

public:
generic <typename T>
 static IntPtr UnsafeAddrOfPinnedArrayElement(cli::array <T> ^ arr, int index);
[System.Security.SecurityCritical]
public static IntPtr UnsafeAddrOfPinnedArrayElement<T> (T[] arr, int index);
public static IntPtr UnsafeAddrOfPinnedArrayElement<T> (T[] arr, int index);
[<System.Security.SecurityCritical>]
static member UnsafeAddrOfPinnedArrayElement : 'T[] * int -> nativeint
static member UnsafeAddrOfPinnedArrayElement : 'T[] * int -> nativeint
Public Shared Function UnsafeAddrOfPinnedArrayElement(Of T) (arr As T(), index As Integer) As IntPtr

類型參數

T

陣列的類型。

參數

arr
T[]

包含所需元素的陣列。

index
Int32

arr 陣列中所需項目的索引。

傳回

IntPtr

nativeint

index 內部的 arr 位址。

屬性

備註

必須先使用 GCHandle 來釘選陣列,才能將其傳遞至這個方法。 為了達到最大效能,這個方法不會驗證傳遞給它的陣列;這可能會導致非預期的行為。

另請參閱

適用於