Marshal.UnsafeAddrOfPinnedArrayElement Method

Definition

Overloads

UnsafeAddrOfPinnedArrayElement(Array, Int32)
Obsolete.

Gets the address of the element at the specified index inside the specified array.

UnsafeAddrOfPinnedArrayElement<T>(T[], Int32)

Gets the address of the element at the specified index in an array of a specified type.

UnsafeAddrOfPinnedArrayElement(Array, Int32)

Caution

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

Gets the address of the element at the specified index inside the specified array.

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

Parameters

arr
Array

The array that contains the desired element.

index
Int32

The index in the arr parameter of the desired element.

Returns

IntPtr

nativeint

The address of index inside arr.

Attributes

Remarks

The array must be pinned using a GCHandle before it is passed to this method. For maximum performance, this method does not validate the array passed to it; this can result in unexpected behavior.

See also

Applies to

UnsafeAddrOfPinnedArrayElement<T>(T[], Int32)

Gets the address of the element at the specified index in an array of a specified type.

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

Type Parameters

T

The type of the array.

Parameters

arr
T[]

The array that contains the desired element.

index
Int32

The index of the desired element in the arr array.

Returns

IntPtr

nativeint

The address of index in arr.

Attributes

Remarks

The array must be pinned by using a GCHandle before it is passed to this method. For maximum performance, this method does not validate the array passed to it; this can result in unexpected behavior.

See also

Applies to