This documentation is archived and is not being maintained.

HasCapability Method

.NET Framework 1.1

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> elements in a DeviceSpecific/Choice construct.

Applications can use the HasCapability method programmatically when they gather device-specific information.

public bool HasCapability(
   string capabilityName,
   string optionalArgument


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


If the 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, an ArgumentOutOfRange exception is thrown.


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.

See Also

Applies to: MobileCapabilities Class