Compartilhar via


Método Marshal.UnsafeAddrOfPinnedArrayElement (Array, Int32)

 

Dica

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Obtém o endereço do elemento no índice especificado na matriz especificada.

Namespace:   System.Runtime.InteropServices
Assembly:  mscorlib (em mscorlib.dll)

Sintaxe

[SecurityCriticalAttribute]
public static IntPtr UnsafeAddrOfPinnedArrayElement(
    Array arr,
    int index
)
public:
[SecurityCriticalAttribute]
static IntPtr UnsafeAddrOfPinnedArrayElement(
    Array^ arr,
    int index
)
[<SecurityCriticalAttribute>]
static member UnsafeAddrOfPinnedArrayElement : 
        arr:Array *
        index:int -> nativeint
<SecurityCriticalAttribute>
Public Shared Function UnsafeAddrOfPinnedArrayElement (
    arr As Array,
    index As Integer
) As IntPtr

Parâmetros

  • arr
    Type: System.Array

    A matriz que contém o elemento desejado.

  • index
    Type: System.Int32

    O índice no parâmetro arr do elemento desejado.

Valor Retornado

Type: System.IntPtr

O endereço de index dentro de arr.

Comentários

A matriz deve ser fixada usando um GCHandle antes de ser passado para este método. Para obter desempenho máximo, esse método não valida a matriz passada para ele; Isso pode resultar em comportamento inesperado.

Segurança

SecurityCriticalAttribute

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

Informações de Versão

Plataforma Universal do Windows
Disponível desde 8
.NET Framework
Disponível desde 1.1
Biblioteca de Classes Portátil
Com suporte no: plataformas portáteis do .NET
Windows Phone Silverlight
Disponível desde 8.0
Windows Phone
Disponível desde 8.1

Confira Também

GCHandle
UnsafeAddrOfPinnedArrayElement Sobrecarga
Classe Marshal
Namespace System.Runtime.InteropServices

Retornar ao início