System.Runtime.InteropServices.Marshal.GetObjectForNativeVariant Method

Converts a COM VARIANT to an object.

Syntax

public static object GetObjectForNativeVariant (IntPtr pSrcNativeVariant)

Parameters

pSrcNativeVariant
A pointer to a COM VARIANT.

Returns

An object that corresponds to the pSrcNativeVariant parameter.

Remarks

Marshal.GetObjectForNativeVariant(IntPtr) returns a managed object that corresponds to a raw pointer to an unmanaged VARIANT type. The interop marshaler performs the identical transformation when exposing a VARIANT type to managed code.

Marshal.GetObjectForNativeVariant(IntPtr) provides the opposite functionality of Marshal.GetNativeVariantForObject(object, IntPtr).

When the VARIANT type is VT_ERROR, Marshal.GetObjectForNativeVariant(IntPtr) returns an object of type Int32 instead of UInt32.

Requirements

Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0