Dela via


ApiInformation.IsPropertyPresent(String, String) Method

Definition

Returns true or false to indicate whether a specified property (writeable or read-only) is present for a specified type.

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

Parameters

typeName
String

Platform::String

winrt::hstring

The namespace-qualified name of the type.

propertyName
String

Platform::String

winrt::hstring

The name of the property.

Returns

Boolean

bool

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

Examples

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

Applies to