Returns the specified string converted to a bool value.
- 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.
true if value is equivalent to bool.TrueString; otherwise, false .
Type Reason ArgumentNullException value is a null reference. FormatException value is not equivalent to either bool.TrueString or bool.FalseString.
Documentation for this section has not yet been entered.
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".
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0