Dela via


ApiInformation.IsEventPresent(String, String) Method

Definition

Returns true or false to indicate whether a specified event is present for a specified type.

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

Parameters

typeName
String

Platform::String

winrt::hstring

The namespace-qualified name of the type.

eventName
String

Platform::String

winrt::hstring

The name of the event.

Returns

Boolean

bool

True if the specified event is present for the type; otherwise, false.

Examples

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");
}

Applies to