Share via


ApiInformation.IsMethodPresent Method

Definition

Overloads

IsMethodPresent(String, String)

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

IsMethodPresent(String, String, UInt32)

Returns true or false to indicate whether a specified method overload with the specified number of input parameters is present for a specified type.

IsMethodPresent(String, String)

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

public:
 static bool IsMethodPresent(Platform::String ^ typeName, Platform::String ^ methodName);
/// [Windows.Foundation.Metadata.Overload("IsMethodPresent")]
 static bool IsMethodPresent(winrt::hstring const& typeName, winrt::hstring const& methodName);
[Windows.Foundation.Metadata.Overload("IsMethodPresent")]
public static bool IsMethodPresent(string typeName, string methodName);
function isMethodPresent(typeName, methodName)
Public Shared Function IsMethodPresent (typeName As String, methodName As String) As Boolean

Parameters

typeName
String

Platform::String

winrt::hstring

The namespace-qualified name of the type.

methodName
String

Platform::String

winrt::hstring

The name of the method.

Returns

Boolean

bool

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

Attributes

Examples

if (Windows.Foundation.Metadata.ApiInformation.IsMethodPresent("Windows.Networking.Sockets.StreamSocket", "CancelIOAsync"))
{
    Debug.WriteLine("Windows.Networking.Sockets.StreamSocket.CancelIOAsync method found");
}
else
{
    Debug.WriteLine("Windows.Networking.Sockets.StreamSocket.CancelIOAsync method NOT found");
}

See also

Applies to

IsMethodPresent(String, String, UInt32)

Returns true or false to indicate whether a specified method overload with the specified number of input parameters is present for a specified type.

public:
 static bool IsMethodPresent(Platform::String ^ typeName, Platform::String ^ methodName, unsigned int inputParameterCount);
/// [Windows.Foundation.Metadata.Overload("IsMethodPresentWithArity")]
 static bool IsMethodPresent(winrt::hstring const& typeName, winrt::hstring const& methodName, uint32_t const& inputParameterCount);
[Windows.Foundation.Metadata.Overload("IsMethodPresentWithArity")]
public static bool IsMethodPresent(string typeName, string methodName, uint inputParameterCount);
function isMethodPresent(typeName, methodName, inputParameterCount)
Public Shared Function IsMethodPresent (typeName As String, methodName As String, inputParameterCount As UInteger) As Boolean

Parameters

typeName
String

Platform::String

winrt::hstring

The namespace-qualified name of the type.

methodName
String

Platform::String

winrt::hstring

The name of the method.

inputParameterCount
UInt32

unsigned int

uint32_t

The number of input parameters for the overload.

Returns

Boolean

bool

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

Attributes

Examples

if (Windows.Foundation.Metadata.ApiInformation.IsMethodPresent("Windows.Globalization.PhoneNumberFormatting.PhoneNumberFormatter", "Format", 2))
{
    Debug.WriteLine("Windows.Globalization.PhoneNumberFormatting.PhoneNumberFormatter.Format overload that takes 2 parameters was found");
}
else
{
    Debug.WriteLine("Windows.Globalization.PhoneNumberFormatting.PhoneNumberFormatter.Format overload that takes 2 parameters was NOT found");
}

See also

Applies to