Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
This topic has not yet been rated - Rate this topic

Boolean.Parse Method

Converts the specified string representation of a logical value to its Boolean equivalent.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

public static bool Parse (
	string value
)
public static boolean Parse (
	String value
)
public static function Parse (
	value : String
) : boolean
Not applicable.

Parameters

value

A string containing the value to convert.

Return Value

true if value is equivalent to TrueString; otherwise, false.
Exception typeCondition

ArgumentNullException

value is a null reference (Nothing in Visual Basic).

FormatException

value is not equivalent to TrueString or FalseString.

The value parameter, optionally preceded or trailed by white space, must contain either TrueString or FalseString; otherwise, an exception is thrown. The comparison is case-insensitive.

The following code example illustrates the use of Parse method.

bool val;
string input;

input = bool.TrueString;
val = bool.Parse(input);
Console.WriteLine("{0} parsed as {1}", input, val);

boolean val;
String input;
input = System.Boolean.TrueString ;
val = System.Boolean.Parse(input);
Console.WriteLine("{0} parsed as {1}", input, (System.Boolean)val);

var val : Boolean;
var input : String;

input = Boolean.TrueString;
val = Boolean.Parse(input);
Console.WriteLine("{0} parsed as {1}", input, val);

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.