ApiInformation ApiInformation ApiInformation ApiInformation Class

Definition

Enables you to detect whether a specified member, type, or API contract is present so that you can safely make API calls across a variety of devices.

public : static class ApiInformation
public static class ApiInformation
Public Static Class ApiInformation
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.FoundationContract (introduced v1)

Methods

IsApiContractPresent(String, UInt16) IsApiContractPresent(String, UInt16) IsApiContractPresent(String, UInt16) IsApiContractPresent(String, UInt16)

Returns true or false to indicate whether the API contract with the specified name and major version number is present.

public : static Platform::Boolean IsApiContractPresent(Platform::String contractName, unsigned short majorVersion)
public static bool IsApiContractPresent(String contractName, UInt16 majorVersion)
Public Static Function IsApiContractPresent(contractName As String, majorVersion As UInt16) As bool
var bool = Windows.Foundation.Metadata.ApiInformation.isApiContractPresent(contractName, majorVersion);
Parameters
contractName
Platform::String String String String

The name of the API contract.

majorVersion
unsigned short UInt16 UInt16 UInt16

The major version number of the API contract.

Returns
Platform::Boolean bool bool bool

True if the specified API contract is present; otherwise, false.

Examples

if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsVoipContract", 1))
{
    Debug.WriteLine("Windows.ApplicationModel.Calls.CallsVoipContract v1.x found");
}
else
{
    Debug.WriteLine("Windows.ApplicationModel.Calls.CallsVoipContract v1.x NOT found");
}
See Also

IsApiContractPresent(String, UInt16, UInt16) IsApiContractPresent(String, UInt16, UInt16) IsApiContractPresent(String, UInt16, UInt16) IsApiContractPresent(String, UInt16, UInt16)

Returns true or false to indicate whether the API contract with the specified name and major and minor version number is present.

public : static Platform::Boolean IsApiContractPresent(Platform::String contractName, unsigned short majorVersion, unsigned short minorVersion)
public static bool IsApiContractPresent(String contractName, UInt16 majorVersion, UInt16 minorVersion)
Public Static Function IsApiContractPresent(contractName As String, majorVersion As UInt16, minorVersion As UInt16) As bool
var bool = Windows.Foundation.Metadata.ApiInformation.isApiContractPresent(contractName, majorVersion, minorVersion);
Parameters
contractName
Platform::String String String String

The name of the API contract.

majorVersion
unsigned short UInt16 UInt16 UInt16

The major version number of the API contract.

minorVersion
unsigned short UInt16 UInt16 UInt16

The minor version number of the API contract.

Returns
Platform::Boolean bool bool bool

True if the specified API contract is present; otherwise, false.

Examples

if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsVoipContract", 1, 1))
{
    Debug.WriteLine("Windows.ApplicationModel.Calls.CallsVoipContract v1.1 found");
}
else
{
    Debug.WriteLine("Windows.ApplicationModel.Calls.CallsVoipContract v1.1 NOT found");
}
See Also

IsEnumNamedValuePresent(String, String) IsEnumNamedValuePresent(String, String) IsEnumNamedValuePresent(String, String) IsEnumNamedValuePresent(String, String)

Returns true or false to indicate whether a specified named constant is present for a specified enumeration.

public : static Platform::Boolean IsEnumNamedValuePresent(Platform::String enumTypeName, Platform::String valueName)
public static bool IsEnumNamedValuePresent(String enumTypeName, String valueName)
Public Static Function IsEnumNamedValuePresent(enumTypeName As String, valueName As String) As bool
var bool = Windows.Foundation.Metadata.ApiInformation.isEnumNamedValuePresent(enumTypeName, valueName);
Parameters
enumTypeName
Platform::String String String String

The namespace-qualified name of the type.

valueName
Platform::String String String String

The name of the constant.

Returns
Platform::Boolean bool bool bool

True if the specified constant is present; otherwise, false.

Examples

if (Windows.Foundation.Metadata.ApiInformation.IsEnumNamedValuePresent("Windows.UI.Xaml.Automation.Peers.AutomationControlType", "ComboBox"))
{
    Debug.WriteLine("Windows.UI.Xaml.Automation.Peers.AutomationControlType.ComboBox enum value found");
}
else
{
    Debug.WriteLine("Windows.UI.Xaml.Automation.Peers.AutomationControlType.ComboBox enum value NOT found");
}

IsEventPresent(String, String) IsEventPresent(String, String) IsEventPresent(String, String) IsEventPresent(String, String)

Returns true or false to indicate whether a specified event is present for a specified type.

public : static Platform::Boolean IsEventPresent(Platform::String typeName, Platform::String eventName)
public static bool IsEventPresent(String typeName, String eventName)
Public Static Function IsEventPresent(typeName As String, eventName As String) As bool
var bool = Windows.Foundation.Metadata.ApiInformation.isEventPresent(typeName, eventName);
Parameters
typeName
Platform::String String String String

The namespace-qualified name of the type.

eventName
Platform::String String String String

The name of the event.

Returns
Platform::Boolean bool bool bool

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

Examples

if (Windows.Foundation.Metadata.ApiInformation.IsEventPresent("Windows.Media.Core.AudioTrack", "OpenFailed"))
{
    Debug.WriteLine("Windows.Media.Core.AudioTrack.OpenFailed event found");
}
else
{
    Debug.WriteLine("Windows.Media.Core.AudioTrack.OpenFailed event NOT found");
}

IsMethodPresent(String, String) IsMethodPresent(String, String) IsMethodPresent(String, String) IsMethodPresent(String, String)

Returns true or false to indicate whether a specified method is present for a specified type.

public : static Platform::Boolean IsMethodPresent(Platform::String typeName, Platform::String methodName)
public static bool IsMethodPresent(String typeName, String methodName)
Public Static Function IsMethodPresent(typeName As String, methodName As String) As bool
var bool = Windows.Foundation.Metadata.ApiInformation.isMethodPresent(typeName, methodName);
Parameters
typeName
Platform::String String String String

The namespace-qualified name of the type.

methodName
Platform::String String String String

The name of the method.

Returns
Platform::Boolean bool bool bool

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

Examples

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

IsMethodPresent(String, String, UInt32) IsMethodPresent(String, String, UInt32) IsMethodPresent(String, String, UInt32) IsMethodPresent(String, String, UInt32)

Returns true or false to indicate whether a specified method overload with the specified number of input parameters is present for a specified type.

public : static Platform::Boolean IsMethodPresent(Platform::String typeName, Platform::String methodName, unsigned int inputParameterCount)
public static bool IsMethodPresent(String typeName, String methodName, UInt32 inputParameterCount)
Public Static Function IsMethodPresent(typeName As String, methodName As String, inputParameterCount As UInt32) As bool
var bool = Windows.Foundation.Metadata.ApiInformation.isMethodPresent(typeName, methodName, inputParameterCount);
Parameters
typeName
Platform::String String String String

The namespace-qualified name of the type.

methodName
Platform::String String String String

The name of the method.

inputParameterCount
unsigned int UInt32 UInt32 UInt32

The number of input parameters for the overload.

Returns
Platform::Boolean bool bool bool

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

Examples

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

IsPropertyPresent(String, String) IsPropertyPresent(String, String) IsPropertyPresent(String, String) IsPropertyPresent(String, String)

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

public : static Platform::Boolean IsPropertyPresent(Platform::String typeName, Platform::String propertyName)
public static bool IsPropertyPresent(String typeName, String propertyName)
Public Static Function IsPropertyPresent(typeName As String, propertyName As String) As bool
var bool = Windows.Foundation.Metadata.ApiInformation.isPropertyPresent(typeName, propertyName);
Parameters
typeName
Platform::String String String String

The namespace-qualified name of the type.

propertyName
Platform::String String String String

The name of the property.

Returns
Platform::Boolean bool bool 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");
}

IsReadOnlyPropertyPresent(String, String) IsReadOnlyPropertyPresent(String, String) IsReadOnlyPropertyPresent(String, String) IsReadOnlyPropertyPresent(String, String)

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

public : static Platform::Boolean IsReadOnlyPropertyPresent(Platform::String typeName, Platform::String propertyName)
public static bool IsReadOnlyPropertyPresent(String typeName, String propertyName)
Public Static Function IsReadOnlyPropertyPresent(typeName As String, propertyName As String) As bool
var bool = Windows.Foundation.Metadata.ApiInformation.isReadOnlyPropertyPresent(typeName, propertyName);
Parameters
typeName
Platform::String String String String

The namespace-qualified name of the type.

propertyName
Platform::String String String String

The name of the property.

Returns
Platform::Boolean bool bool bool

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

Examples

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

IsTypePresent(String) IsTypePresent(String) IsTypePresent(String) IsTypePresent(String)

Returns true or false to indicate whether a specified type is present.

public : static Platform::Boolean IsTypePresent(Platform::String typeName)
public static bool IsTypePresent(String typeName)
Public Static Function IsTypePresent(typeName As String) As bool
var bool = Windows.Foundation.Metadata.ApiInformation.isTypePresent(typeName);
Parameters
typeName
Platform::String String String String

The namespace-qualified name of the type.

Returns
Platform::Boolean bool bool bool

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

Examples

if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.System.AppDiagnosticInfo"))
{
    Debug.WriteLine("Windows.System.AppDiagnosticInfo type was found");
}
else
{
    Debug.WriteLine("Windows.System.AppDiagnosticInfo type was NOT found");
}

IsWriteablePropertyPresent(String, String) IsWriteablePropertyPresent(String, String) IsWriteablePropertyPresent(String, String) IsWriteablePropertyPresent(String, String)

Returns true or false to indicate whether a specified writeable property is present for a specified type.

public : static Platform::Boolean IsWriteablePropertyPresent(Platform::String typeName, Platform::String propertyName)
public static bool IsWriteablePropertyPresent(String typeName, String propertyName)
Public Static Function IsWriteablePropertyPresent(typeName As String, propertyName As String) As bool
var bool = Windows.Foundation.Metadata.ApiInformation.isWriteablePropertyPresent(typeName, propertyName);
Parameters
typeName
Platform::String String String String

The namespace-qualified name of the type.

propertyName
Platform::String String String String

The name of the property.

Returns
Platform::Boolean bool bool bool

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

Examples

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