Bagikan melalui


ApiInformation.IsReadOnlyPropertyPresent(String, String) Metode

Definisi

Mengembalikan true atau false untuk menunjukkan apakah properti baca-saja tertentu ada untuk jenis tertentu.

public:
 static bool IsReadOnlyPropertyPresent(Platform::String ^ typeName, Platform::String ^ propertyName);
 static bool IsReadOnlyPropertyPresent(winrt::hstring const& typeName, winrt::hstring const& propertyName);
public static bool IsReadOnlyPropertyPresent(string typeName, string propertyName);
function isReadOnlyPropertyPresent(typeName, propertyName)
Public Shared Function IsReadOnlyPropertyPresent (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

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

Contoh

if (Windows.Foundation.Metadata.ApiInformation.IsReadOnlyPropertyPresent("Windows.Devices.Sensors.Accelerometer", "ReadingType"))
{
    Debug.WriteLine("Windows.Devices.Sensors.Accelerometer.ReadingType read-only property was found");
}
else
{
    Debug.WriteLine("Windows.Devices.Sensors.Accelerometer.ReadingType read-only property was NOT found");
}

Berlaku untuk