Compartilhar via


Método Marshal.GetObjectForNativeVariant (IntPtr)

 

Dica

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

Converte um COM VARIANT em um objeto.

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

Sintaxe

[SecurityCriticalAttribute]
public static object GetObjectForNativeVariant(
    IntPtr pSrcNativeVariant
)
public:
[SecurityCriticalAttribute]
static Object^ GetObjectForNativeVariant(
    IntPtr pSrcNativeVariant
)
[<SecurityCriticalAttribute>]
static member GetObjectForNativeVariant : 
        pSrcNativeVariant:nativeint -> Object
<SecurityCriticalAttribute>
Public Shared Function GetObjectForNativeVariant (
    pSrcNativeVariant As IntPtr
) As Object

Parâmetros

  • pSrcNativeVariant
    Type: System.IntPtr

    Um ponteiro para um COM VARIANT.

Valor Retornado

Type: System.Object

Um objeto que corresponde ao parâmetro pSrcNativeVariant.

Exceções

Exception Condition
InvalidOleVariantTypeException

pSrcNativeVariant não é um tipo VARIANT válido.

NotSupportedException

pSrcNativeVariant tem um tipo sem suporte.

Comentários

GetObjectForNativeVariantRetorna um objeto gerenciado que corresponde a um ponteiro bruto para um tipo de VARIANTE não gerenciado. O interopmarshaler realiza a transformação idêntica ao expor um tipo VARIANT para código gerenciado.

GetObjectForNativeVariantfornece a funcionalidade oposta do Marshal.GetNativeVariantForObject.

Quando o tipo de VARIANTE é VT_ERROR, GetObjectForNativeVariant retorna um objeto do tipo Int32 em vez de UInt32.

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

GetNativeVariantForObject
GetObjectForNativeVariant Sobrecarga
Classe Marshal
Namespace System.Runtime.InteropServices

Retornar ao início