The Boolean.Parse() method in C# is used to convert the specified string representation of a logical value to its Boolean equivalent.
Syntax
Following is the syntax −
public static bool Parse (string val);
Above, the parameter value is a string containing the value to convert.
Example
Let us now see an example to implement the Boolean.Parse() method −
using System;
public class Demo {
public static void Main(){
bool b;
b = bool.Parse("FALSE");
Console.WriteLine("After parsing = "+b);
}
}Output
This will produce the following output −
After parsing = False
Example
Let us see another example −
using System;
public class Demo {
public static void Main(){
bool b;
b = bool.Parse(bool.TrueString);
Console.WriteLine("After parsing = "+b);
}
}Output
This will produce the following output −
After parsing = True