Mono Class Library: System.Boolean Overview | Members

System.Boolean.Parse Method

Returns the specified string converted to a bool value. [Edit]

public static bool Parse (string value)

Parameters

value
A string containing the value to convert. The string is equivalent to either bool.TrueString or bool.FalseString, can contain leading and/or trailing whitespace, and is parsed in a case-insensitive manner. [Edit]

Returns

true if value is equivalent to bool.TrueString; otherwise, false . [Edit]

Exceptions

TypeReason
ArgumentNullExceptionvalue is a null reference. [Edit]
FormatExceptionvalue is not equivalent to either bool.TrueString or bool.FalseString. [Edit]

Remarks

Documentation for this section has not yet been entered. [Edit]

Example

The following example demonstrates the bool.Parse(string) method.

C# Example
using System;
public class BoolParse {
   public static void Main() {
      Boolean b = Boolean.Parse("  true  ");
      Console.WriteLine("\"  true  \" parses to \"{0}\".", b);
   }
}
   

The output is

" true " parses to "True".

Requirements

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