Marshal.GetObjectForNativeVariant 方法

定义

重载

GetObjectForNativeVariant(IntPtr)
已过时.

将 COM VARIANT 转换为对象。

GetObjectForNativeVariant<T>(IntPtr)
已过时.

将 COM VARIANT 转换为指定类型的对象。

GetObjectForNativeVariant(IntPtr)

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

注意

GetObjectForNativeVariant(IntPtr) may be unavailable in future releases.

将 COM VARIANT 转换为对象。

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

参数

pSrcNativeVariant
IntPtr

nativeint

指向 COM VARIANT 的指针。

返回

对应于 pSrcNativeVariant 参数的对象。

属性

例外

pSrcNativeVariant 不是有效的 VARIANT 类型。

pSrcNativeVariant 包含不受支持的类型。

注解

GetObjectForNativeVariant 返回一个托管对象,该对象对应于指向非托管 VARIANT 类型的原始指针。 向托管代码公开 VARIANT 类型时,互操作shaler 执行相同的转换。

GetObjectForNativeVariant 提供 的相反功能 Marshal.GetNativeVariantForObject

当 VARIANT 类型为 VT_ERROR 时, GetObjectForNativeVariant 返回类型 Int32 为 的对象, UInt32而不是 。

另请参阅

适用于

GetObjectForNativeVariant<T>(IntPtr)

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

注意

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

将 COM VARIANT 转换为指定类型的对象。

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

类型参数

T

要将 COM VARIANT 转换为的类型。

参数

pSrcNativeVariant
IntPtr

nativeint

指向 COM VARIANT 的指针。

返回

T

一个与 pSrcNativeVariant 参数对应的指定类型的对象。

属性

例外

pSrcNativeVariant 不是有效的 VARIANT 类型。

pSrcNativeVariant 包含不受支持的类型。

注解

GetObjectForNativeVariant<T>(IntPtr) 返回类型的 T 托管对象,该对象对应于指向非托管 VARIANT 类型的原始指针。 向托管代码公开 VARIANT 类型时,互操作shaler 执行相同的转换。

GetObjectForNativeVariant<T>(IntPtr) 提供 的相反功能 GetNativeVariantForObject<T>(T, IntPtr)

适用于