Marshal::GetObjectForNativeVariant<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.
Assembly: mscorlib (in mscorlib.dll)
public: generic<typename T> [SecurityCriticalAttribute] static T GetObjectForNativeVariant( IntPtr pSrcNativeVariant )
Parameters
- pSrcNativeVariant
-
Type:
System::IntPtr
A pointer to a COM VARIANT.
Return Value
Type: TAn object of the specified type that corresponds to the pSrcNativeVariant parameter.
Type Parameters
- T
The type to which to convert the COM VARIANT.
| Exception | Condition |
|---|---|
| InvalidOleVariantTypeException | pSrcNativeVariant is not a valid VARIANT type. |
| NotSupportedException | pSrcNativeVariant has an unsupported type. |
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 ofGetNativeVariantForObject<T>(T, IntPtr).
requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.
Available since 8.1
.NET Framework
Available since 4.5.1
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.1