This documentation is archived and is not being maintained.

MobileCapabilities::HasCapability Method

Provides a uniform way to evaluate device capabilities. This method is used internally by ASP.NET to implement various device-selection criteria expressed in the syntax of the controls. For example, this method is used to choose among <Choice> Element (.NET Framework Developer's Guide ) elements in a DeviceSpecific/Choice construct.

Namespace:  System.Web.Mobile
Assembly:  System.Web.Mobile (in System.Web.Mobile.dll)

public:
bool HasCapability(
	String^ delegateName, 
	String^ optionalParameter
)

Parameters

delegateName
Type: System::String

The device evaluation method, property name, or item in the capabilities collection.

optionalParameter
Type: System::String

The optional argument.

Return Value

Type: System::Boolean
true if the device has the specified capability; otherwise, false.

ExceptionCondition
ArgumentOutOfRangeException

A capabilityName parameter is not found as a device-filter name specified in the configuration file, as a MobileCapabilities property, or as an item in the MobileCapabilities Item collection.

ArgumentException

delegateName is nullptr or empty.

Applications can use the HasCapability method programmatically when they gather device-specific information. If the capabilityName parameter specifies a device evaluation method, the optionalArgument parameter is passed to this method. If the capabilityName parameter specifies a property name or item in the capabilities dictionary, the HasCapability method checks whether the property or item is equal to the optionalArgument parameter.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1
Show: