Bagikan melalui


ApiInformation.IsMethodPresent Metode

Definisi

Overload

IsMethodPresent(String, String)

Mengembalikan true atau false untuk menunjukkan apakah metode tertentu ada untuk jenis tertentu.

IsMethodPresent(String, String, UInt32)

Mengembalikan true atau false untuk menunjukkan apakah metode yang ditentukan kelebihan beban dengan jumlah parameter input yang ditentukan ada untuk jenis tertentu.

IsMethodPresent(String, String)

Mengembalikan true atau false untuk menunjukkan apakah metode tertentu ada untuk jenis tertentu.

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

Parameter

typeName
String

Platform::String

winrt::hstring

Nama tipe yang memenuhi syarat namespace.

methodName
String

Platform::String

winrt::hstring

Nama metode .

Mengembalikan

Boolean

bool

True jika metode yang ditentukan ada untuk jenis ; jika tidak, salah.

Atribut

Contoh

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

Lihat juga

Berlaku untuk

IsMethodPresent(String, String, UInt32)

Mengembalikan true atau false untuk menunjukkan apakah metode yang ditentukan kelebihan beban dengan jumlah parameter input yang ditentukan ada untuk jenis tertentu.

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

Parameter

typeName
String

Platform::String

winrt::hstring

Nama tipe yang memenuhi syarat namespace.

methodName
String

Platform::String

winrt::hstring

Nama metode .

inputParameterCount
UInt32

unsigned int

uint32_t

Jumlah parameter input untuk kelebihan beban.

Mengembalikan

Boolean

bool

True jika metode yang ditentukan ada untuk jenis ; jika tidak, salah.

Atribut

Contoh

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

Lihat juga

Berlaku untuk