我不确定这在 WinRT 中是新的还是以前存在的;在 IDL 中,您可以编写如下声明:
[uuid(E9C62AEE-1494-4A21-BB7E-8589FC751D9D)]
[version(0x06020000)]
[exclusiveto(Windows.Networking.Sockets.DatagramSocket)]
interface IDatagramSocketStatics : IInspectable
{
[overload("GetEndpointPairsAsync")] HRESULT GetEndpointPairsAsync(
[in] Windows.Networking.HostName* remoteHostName,
[in] HSTRING remoteServiceName,
[out] [retval] Windows.Foundation.IAsyncOperation
<Windows.Foundation.Collections.IVectorView
<Windows.Networking.EndpointPair*>*>** operation);
[overload("GetEndpointPairsAsync")] HRESULT GetEndpointPairsWithSortOptionsAsync(
[in] Windows.Networking.HostName* remoteHostName,
[in] HSTRING remoteServiceName,
[in] Windows.Networking.HostNameSortOptions sortOptions,
[out] [retval] Windows.Foundation.IAsyncOperation
<Windows.Foundation.Collections.IVectorView<
<Windows.Networking.EndpointPair*>*>** operation);
}
其意图显然是 WinRT 操作“GetEndpointPairAsync”被重载了两次,一次为 GetEndpointPairsAsync,一次为 GetEndpointPairsWithSortOptionsAsync。
是否可以通过 IMetaDataImport 学习到两个底层操作名称?我需要找出来生成调用这些方法的 C 代码,而我从 EnumMethods 得到的只是重载的名称。