共用方式為


Marshal.GetObjectForNativeVariant 方法

定義

多載

GetObjectForNativeVariant(IntPtr)
已淘汰.

將 COM VARIANT 轉換為物件。

GetObjectForNativeVariant<T>(IntPtr)
已淘汰.

將 COM VARIANT 轉換為所指定類型的物件。

GetObjectForNativeVariant(IntPtr)

來源:
Marshal.NoCom.cs
來源:
Marshal.NoCom.cs
來源:
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 會傳回 Managed 對象,對應至 Unmanaged VARIANT 類型的原始指標。 Interopmarshaler 會在向 Managed 程式代碼公開 VARIANT 類型時執行相同的轉換。

GetObjectForNativeVariant 提供的相反功能 Marshal.GetNativeVariantForObject

當 VARIANT 類型VT_ERROR時, GetObjectForNativeVariant 會傳回 型 Int32 別的物件,而不是 UInt32

另請參閱

適用於

GetObjectForNativeVariant<T>(IntPtr)

來源:
Marshal.NoCom.cs
來源:
Marshal.NoCom.cs
來源:
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 別的 Managed 物件,該對象對應至 Unmanaged VARIANT 類型的原始指標。 Interopmarshaler 會在向 Managed 程式代碼公開 VARIANT 類型時執行相同的轉換。

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

適用於