Rediger

Del via


Marshal.GetObjectForNativeVariant Method

Definition

Overloads

GetObjectForNativeVariant(IntPtr)
Obsolete.

Converts a COM VARIANT to an object.

GetObjectForNativeVariant<T>(IntPtr)
Obsolete.

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

GetObjectForNativeVariant(IntPtr)

Source:
Marshal.NoCom.cs
Source:
Marshal.NoCom.cs
Source:
Marshal.NoCom.cs

Caution

GetObjectForNativeVariant(IntPtr) may be unavailable in future releases.

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);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static object? GetObjectForNativeVariant (IntPtr pSrcNativeVariant);
[System.Obsolete("GetObjectForNativeVariant(IntPtr) may be unavailable in future releases.")]
public static object GetObjectForNativeVariant (IntPtr pSrcNativeVariant);
public static object? GetObjectForNativeVariant (IntPtr pSrcNativeVariant);
public static object GetObjectForNativeVariant (IntPtr pSrcNativeVariant);
[System.Security.SecurityCritical]
public static object GetObjectForNativeVariant (IntPtr pSrcNativeVariant);
[<System.Obsolete("GetObjectForNativeVariant(IntPtr) may be unavailable in future releases.")>]
[<System.Security.SecurityCritical>]
static member GetObjectForNativeVariant : nativeint -> obj
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member GetObjectForNativeVariant : nativeint -> obj
[<System.Obsolete("GetObjectForNativeVariant(IntPtr) may be unavailable in future releases.")>]
static member GetObjectForNativeVariant : nativeint -> obj
static member GetObjectForNativeVariant : nativeint -> obj
[<System.Security.SecurityCritical>]
static member GetObjectForNativeVariant : nativeint -> obj
Public Shared Function GetObjectForNativeVariant (pSrcNativeVariant As IntPtr) As Object

Parameters

pSrcNativeVariant
IntPtr

nativeint

A pointer to a COM VARIANT.

Returns

An object that corresponds to the pSrcNativeVariant parameter.

Attributes

Exceptions

pSrcNativeVariant is not a valid VARIANT type.

pSrcNativeVariant has an unsupported type.

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.

See also

Applies to

GetObjectForNativeVariant<T>(IntPtr)

Source:
Marshal.NoCom.cs
Source:
Marshal.NoCom.cs
Source:
Marshal.NoCom.cs

Caution

GetObjectForNativeVariant<T>(IntPtr) may be unavailable in future releases.

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);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static T? GetObjectForNativeVariant<T> (IntPtr pSrcNativeVariant);
[System.Obsolete("GetObjectForNativeVariant<T>(IntPtr) may be unavailable in future releases.")]
public static T GetObjectForNativeVariant<T> (IntPtr pSrcNativeVariant);
public static T GetObjectForNativeVariant<T> (IntPtr pSrcNativeVariant);
[System.Security.SecurityCritical]
public static T GetObjectForNativeVariant<T> (IntPtr pSrcNativeVariant);
[<System.Obsolete("GetObjectForNativeVariant<T>(IntPtr) may be unavailable in future releases.")>]
[<System.Security.SecurityCritical>]
static member GetObjectForNativeVariant : nativeint -> 'T
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member GetObjectForNativeVariant : nativeint -> 'T
[<System.Obsolete("GetObjectForNativeVariant<T>(IntPtr) may be unavailable in future releases.")>]
static member GetObjectForNativeVariant : nativeint -> 'T
static member GetObjectForNativeVariant : nativeint -> 'T
[<System.Security.SecurityCritical>]
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

nativeint

A pointer to a COM VARIANT.

Returns

T

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

Attributes

Exceptions

pSrcNativeVariant is not a valid VARIANT type.

pSrcNativeVariant has an unsupported type.

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

Applies to