Mono Class Library: System.Xml.XmlConvert Overview | Members

System.Xml.XmlConvert.ToBoolean Method

Converts a string to a bool equivalent.

public static bool ToBoolean (string s)

Parameters

s
The string to convert.

Returns

The bool equivalent of s.

Exceptions

TypeReason
ArgumentNullExceptions is a null reference.
FormatExceptions does not represent a bool value.

Remarks

This method removes leading and trailing white space. After this trimming, valid strings are "1" and "true", which return true, and "0" and "false", which return false.

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0