Converts the "true" and "false" strings to Boolean true and false values, respectively.
[Visual Basic] Public Shared Function FromString( _ ByVal value As String _ ) As Boolean [C#] public static bool FromString( string value ); [C++] public: static bool FromString( String* value ); [JScript] public static function FromString( value : String ) : Boolean;
A true or false Boolean value.
Exception Type | Condition |
---|---|
ArgumentException | If the string is null. |
FormatException | If the string does not match. |
The FromString method provides a means of changing true and false strings to Boolean values.
The string parameter must provide a case-insensitive match with either "true" or "false". Leading and trailing white space is allowed and ignored.
The return value is a true Boolean value if the value is a case-insensitive match for "true", or a "false" Boolean value if it is a case-insensitive match for "false".
If the return valuedoes not match "true" or "false", then an exception is thrown. It will ignore the case of the text, as well as leading or trailing white space.