Export (0) Print
Expand All

Marshal::GetNativeVariantForObject<T> Method (T, IntPtr)

Note: This API is now obsolete.

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

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

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

[ObsoleteAttribute(L"GetNativeVariantForObject<T>(T, IntPtr) may be unavailable in future releases.")]
public:
generic<typename T>
static void GetNativeVariantForObject(
	T obj, 
	IntPtr pDstNativeVariant
)

Type Parameters

T

The type of the object to convert.

Parameters

obj
Type: T

The object for which to get a COM VARIANT.

pDstNativeVariant
Type: System::IntPtr

A pointer to receive the VARIANT that corresponds to the obj parameter.

The pDstNativeVariant parameter must point to sufficient memory to store the resulting VARIANT. Also, the implementation of this method calls VariantInit Function on the raw memory that the pDstNativeVariant parameter points to.

.NET Framework

Supported in: 4.6, 4.5.1
Obsolete (compiler warning) in 4.6

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.

Show:
© 2015 Microsoft