共用方式為


ApiInformation.IsEventPresent(String, String) 方法

定義

傳回 true 或 false,指出指定的類型是否存在指定的事件。

public:
 static bool IsEventPresent(Platform::String ^ typeName, Platform::String ^ eventName);
 static bool IsEventPresent(winrt::hstring const& typeName, winrt::hstring const& eventName);
public static bool IsEventPresent(string typeName, string eventName);
function isEventPresent(typeName, eventName)
Public Shared Function IsEventPresent (typeName As String, eventName As String) As Boolean

參數

typeName
String

Platform::String

winrt::hstring

型別的命名空間限定名稱。

eventName
String

Platform::String

winrt::hstring

事件的名稱。

傳回

Boolean

bool

如果 類型的指定事件存在,則為 True;否則為 false

範例

if (Windows.Foundation.Metadata.ApiInformation.IsEventPresent("Windows.Media.Core.AudioTrack", "OpenFailed"))
{
    Debug.WriteLine("Windows.Media.Core.AudioTrack.OpenFailed event found");
}
else
{
    Debug.WriteLine("Windows.Media.Core.AudioTrack.OpenFailed event NOT found");
}

適用於