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> 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
)

Parameters

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

Exceptions

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.

Remarks

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