Export (0) Print
Expand All

Marshal.GetNativeVariantForObject(T) Method (T, IntPtr)

[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
Assembly:  mscorlib (in mscorlib.dll)

static member GetNativeVariantForObject : 
        obj:'T * 
        pDstNativeVariant:IntPtr -> unit

Type Parameters


The type of the object to convert.


Type: T

The object for which to get a COM VARIANT.

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

© 2014 Microsoft