ApiInformation.IsPropertyPresent(String, String) Metode

Definisi

Mengembalikan true atau false untuk menunjukkan apakah properti tertentu (dapat ditulis atau baca-saja) ada untuk jenis tertentu.

public:
 static bool IsPropertyPresent(Platform::String ^ typeName, Platform::String ^ propertyName);
 static bool IsPropertyPresent(winrt::hstring const& typeName, winrt::hstring const& propertyName);
public static bool IsPropertyPresent(string typeName, string propertyName);
function isPropertyPresent(typeName, propertyName)
Public Shared Function IsPropertyPresent (typeName As String, propertyName As String) As Boolean

Parameter

typeName
String

Platform::String

winrt::hstring

Nama tipe yang memenuhi syarat namespace.

propertyName
String

Platform::String

winrt::hstring

Nama properti.

Mengembalikan

Boolean

bool

Benar jika properti yang ditentukan ada untuk jenis; jika tidak, salah.

Contoh

if (Windows.Foundation.Metadata.ApiInformation.IsPropertyPresent("Windows.Devices.Sensors.Accelerometer", "ReadingTransform"))
{
    Debug.WriteLine("Windows.Devices.Sensors.Accelerometer.ReadingTransform property was found");
}
else
{
    Debug.WriteLine("Windows.Devices.Sensors.Accelerometer.ReadingTransform property was NOT found");
}

Berlaku untuk