Export (0) Print
Expand All

Marshal.UnsafeAddrOfPinnedArrayElement(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
Assembly:  mscorlib (in mscorlib.dll)

static member UnsafeAddrOfPinnedArrayElement : 
        arr:'T[] * 
        index:int -> IntPtr

Type Parameters


The type of the array.


Type: T[]

The array that contains the desired element.

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.5.1

.NET for Windows Phone apps

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.

Windows Phone 8.1

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft