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

指向所请求接口的非托管指针。

属性

例外

仅限 .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) 提供的公共语言运行时无效,IID_CLRRuntimeHost3
CLSID_TypeNameFactory IID_TypeNameFactory
CLSID_CLRStrongName IID_CLRStrongName

GetRuntimeInterfaceAsIntPtr 类似于 GetRuntimeInterfaceAsObject 方法。

适用于