Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library

Marshal.GetObjectForNativeVariant Method (IntPtr)

Note: This API is now obsolete.

Converts a COM VARIANT to an object.

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

[ObsoleteAttribute("GetObjectForNativeVariant(IntPtr) may be unavailable in future releases.")]
public static Object GetObjectForNativeVariant(
	IntPtr pSrcNativeVariant
)

Parameters

pSrcNativeVariant
Type: System.IntPtr

A pointer to a COM VARIANT.

Return Value

Type: System.Object
An object that corresponds to the pSrcNativeVariant parameter.

ExceptionCondition
InvalidOleVariantTypeException

pSrcNativeVariant is not a valid VARIANT type.

NotSupportedException

pSrcNativeVariant has an unsupported type.

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

GetObjectForNativeVariant provides the opposite functionality of Marshal.GetNativeVariantForObject.

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1
Obsolete (compiler warning) in 4.6

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Portable Class Library

Supported in: Portable Class Library

  • SecurityCriticalAttribute 

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

Show:
© 2015 Microsoft