共用方式為


ApiInformation.IsReadOnlyPropertyPresent(String, String) 方法

定義

會傳回 true 或 false,指出指定的唯讀屬性是否存在於指定的型別。

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

參數

typeName
String

Platform::String

winrt::hstring

型別的命名空間限定名稱。

propertyName
String

Platform::String

winrt::hstring

屬性的名稱。

傳回

Boolean

bool

如果 型別有指定的屬性,則為 True;否則為 false

範例

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

適用於