Boolean::Parse Method
Updated: September 2010
Converts the specified string representation of a logical value to its Boolean equivalent, or throws an exception if the string is not equivalent to the value of Boolean::TrueString or Boolean::FalseString.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- value
- Type: System::String
A string containing the value to convert.
Return Value
Type: System::Booleantrue if value is equivalent to the value of the Boolean::TrueString field; false if value is equivalent to the value of the Boolean::FalseString field.
| Exception | Condition |
|---|---|
| ArgumentNullException | value is nullptr. |
| FormatException | value is not equivalent to the value of the TrueString or FalseString field. |
The value parameter, optionally preceded or trailed by white space, must contain a string that is equivalent to the value of either the Boolean::TrueString or Boolean::FalseString field; otherwise, a FormatException is thrown. The comparison is case-insensitive.
The following example calls the Parse method to parse an array of strings. Note that the parse operation succeeds only if the string to be parsed is "True" (the value of the TrueString field) or "False" (the value of the FalseString field) in a case-insensitive comparison.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.