Export (0) Print
Expand All

Marshal.GetObjectForNativeVariant(Of T) Method (IntPtr)

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

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

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

'Declaration
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
Type: System.IntPtr

A pointer to a COM VARIANT.

Return Value

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

ExceptionCondition
InvalidOleVariantTypeException

pSrcNativeVariant is not a valid VARIANT type.

NotSupportedException

pSrcNativeVariant has an unsupported type.

GetObjectForNativeVariant(Of T)(IntPtr) returns a managed object of type T 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(Of T)(IntPtr) provides the opposite functionality of GetNativeVariantForObject(Of T)(T, IntPtr).

.NET Framework

Supported in: 4.5.1

.NET for Windows Phone apps

Obsolete (compiler warning) in Windows Phone 8.1

  • SecurityCriticalAttribute 

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

Windows Phone 8.1

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft