Marshal.GetObjectForNativeVariant Marshal.GetObjectForNativeVariant Marshal.GetObjectForNativeVariant Marshal.GetObjectForNativeVariant Method

Definition

Overloads

GetObjectForNativeVariant(IntPtr) GetObjectForNativeVariant(IntPtr) GetObjectForNativeVariant(IntPtr) GetObjectForNativeVariant(IntPtr)

Converts a COM VARIANT to an object.

GetObjectForNativeVariant<T>(IntPtr) GetObjectForNativeVariant<T>(IntPtr) GetObjectForNativeVariant<T>(IntPtr) GetObjectForNativeVariant<T>(IntPtr)

[Supported in the .NET Framework 4.5.1 and later versions]

Converts a COM VARIANT to an object of a specified type.

GetObjectForNativeVariant(IntPtr) GetObjectForNativeVariant(IntPtr) GetObjectForNativeVariant(IntPtr) GetObjectForNativeVariant(IntPtr)

Warning

This API is now obsolete.

Converts a COM VARIANT to an object.

public:
 static System::Object ^ GetObjectForNativeVariant(IntPtr pSrcNativeVariant);
[System.Obsolete("GetObjectForNativeVariant(IntPtr) may be unavailable in future releases.")]
[System.Security.SecurityCritical]
public static object GetObjectForNativeVariant (IntPtr pSrcNativeVariant);
static member GetObjectForNativeVariant : nativeint -> obj
Public Shared Function GetObjectForNativeVariant (pSrcNativeVariant As IntPtr) As Object

Parameters

pSrcNativeVariant
IntPtr IntPtr IntPtr IntPtr

A pointer to a COM VARIANT.

Returns

An object that corresponds to the pSrcNativeVariant parameter.

Exceptions

Remarks

GetObjectForNativeVariant returns a managed object that corresponds to a raw pointer to an unmanaged VARIANT type. The interopmarshaler 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.

Security

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

See also

GetObjectForNativeVariant<T>(IntPtr) GetObjectForNativeVariant<T>(IntPtr) GetObjectForNativeVariant<T>(IntPtr) GetObjectForNativeVariant<T>(IntPtr)

Warning

This API is now obsolete.

[Supported in the .NET Framework 4.5.1 and later versions]

Converts a COM VARIANT to an object of a specified type.

public:
generic <typename T>
 static T GetObjectForNativeVariant(IntPtr pSrcNativeVariant);
[System.Obsolete("GetObjectForNativeVariant<T>(IntPtr) may be unavailable in future releases.")]
[System.Security.SecurityCritical]
public static T GetObjectForNativeVariant<T> (IntPtr pSrcNativeVariant);
static member GetObjectForNativeVariant : nativeint -> 'T
Public Shared Function GetObjectForNativeVariant(Of T) (pSrcNativeVariant As IntPtr) As T

Type Parameters

T

The type to which to convert the COM VARIANT.

Parameters

pSrcNativeVariant
IntPtr IntPtr IntPtr IntPtr

A pointer to a COM VARIANT.

Returns

T T T T

An object of the specified type that corresponds to the pSrcNativeVariant parameter.

Exceptions

Remarks

GetObjectForNativeVariant<T>(IntPtr) returns a managed object of type T that corresponds to a raw pointer to an unmanaged VARIANT type. The interopmarshaler performs the identical transformation when exposing a VARIANT type to managed code.

GetObjectForNativeVariant<T>(IntPtr) provides the opposite functionality of GetNativeVariantForObject<T>(T, IntPtr).

Security

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

Applies to