Export (0) Print
Expand All

Marshal.UnsafeAddrOfPinnedArrayElement(Of T) Method (T(), Int32)

[Supported in the .NET Framework 4.5.1 and later versions]

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

Namespace:  System.Runtime.InteropServices
Assemblies:   System.Runtime.InteropServices (in System.Runtime.InteropServices.dll)
  mscorlib (in mscorlib.dll)

'Declaration
Public Shared Function UnsafeAddrOfPinnedArrayElement(Of T) ( _
	arr As T(), _
	index As Integer _
) As IntPtr

Type Parameters

T

The type of the array.

Parameters

arr
Type: T()

The array that contains the desired element.

index
Type: System.Int32

The index of the desired element in the arr array.

Return Value

Type: System.IntPtr
The address of index in arr.

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.

.NET Framework

Supported in: 4.6, 4.5.1

Supported in: Windows Phone 8.1

  • SecurityCriticalAttribute 

    requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

Show:
© 2015 Microsoft