共用方式為


RuntimeEnvironment.GetRuntimeInterfaceAsIntPtr(Guid, Guid) 方法

定義

警告

RuntimeEnvironment members SystemConfigurationFile, GetRuntimeInterfaceAsIntPtr, and GetRuntimeInterfaceAsObject are not supported and throw PlatformNotSupportedException.

傳回指定類別上的指定介面。

public:
 static IntPtr GetRuntimeInterfaceAsIntPtr(Guid clsid, Guid riid);
public static IntPtr GetRuntimeInterfaceAsIntPtr (Guid clsid, Guid riid);
[System.Obsolete("RuntimeEnvironment members SystemConfigurationFile, GetRuntimeInterfaceAsIntPtr, and GetRuntimeInterfaceAsObject are not supported and throw PlatformNotSupportedException.", DiagnosticId="SYSLIB0019", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static IntPtr GetRuntimeInterfaceAsIntPtr (Guid clsid, Guid riid);
[System.Runtime.InteropServices.ComVisible(false)]
[System.Security.SecurityCritical]
public static IntPtr GetRuntimeInterfaceAsIntPtr (Guid clsid, Guid riid);
static member GetRuntimeInterfaceAsIntPtr : Guid * Guid -> nativeint
[<System.Obsolete("RuntimeEnvironment members SystemConfigurationFile, GetRuntimeInterfaceAsIntPtr, and GetRuntimeInterfaceAsObject are not supported and throw PlatformNotSupportedException.", DiagnosticId="SYSLIB0019", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member GetRuntimeInterfaceAsIntPtr : Guid * Guid -> nativeint
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Security.SecurityCritical>]
static member GetRuntimeInterfaceAsIntPtr : Guid * Guid -> nativeint
Public Shared Function GetRuntimeInterfaceAsIntPtr (clsid As Guid, riid As Guid) As IntPtr

參數

clsid
Guid

所需類別的識別項。

riid
Guid

所需介面的識別項。

傳回

IntPtr

nativeint

要求之介面的 Unmanaged 指標。

屬性

例外狀況

僅限 .NET Core 與 .NET 5+:在所有情況下。

備註

下表顯示clsidriid的支援組合。

clsid riid
CLSID_CorMetaDataDispenser IID_IMetaDataDispenser、IID_IMetaDataDispenserEx
CLSID_CorMetaDataDispenserRuntime IID_IMetaDataDispenser、IID_IMetaDataDispenserEx
CLSID_CorRuntimeHost IID_CorRuntimeHost
CLSID_CLRRuntimeHost IID_CLRRuntimeHost (.NET Framework 4) 所提供的 Common Language Runtime 無效,IID_CLRRuntimeHost3
CLSID_TypeNameFactory IID_TypeNameFactory
CLSID_CLRStrongName IID_CLRStrongName

GetRuntimeInterfaceAsIntPtr 類似於 GetRuntimeInterfaceAsObject 方法。

適用於