System.Xml.XmlConvert.ToBoolean Method

Converts the string to a bool equivalent.

Syntax

public static bool ToBoolean (string s)

Parameters

s
The string to convert.

Returns

A Boolean value, that is, true or false.

Exceptions

TypeReason
ArgumentNullException s is a null reference.
FormatException s does not represent a bool value.

Remarks

Valid strings are "1" or "true" for true and "0" or "false" for false.

Requirements

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