
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Formatting Data in Strings
|
63
None
Applies none of the styles.
Number
Equivalent to AllowLeadingWhite, AllowTrailingWhite, AllowLeadingSign, Allow-
TrailingSign
, AllowDecimalPoint, and AllowThousands.
If the
NumberStyle parameter is not supplied when it is required (as when, for exam-
ple, a numeric string includes a thousands separator) or if the
NumberStyle enumera-
tion is used on a string that does not contain a number in the supplied
NumberStyle
format, a FormatException exception will be thrown. If the size of the number in the
string is too large or too small for the data type, an OverFlowException exception will
be thrown. Passing in a
null for the SourceString parameter will throw an
ArgumentNullException exception.
The
Parse method of the two non-numeric data types, bool and char, also deserve
some additional explanation. When calling
Boolean.Parse, if a string value contains
anything except a value equal to the static properties
Boolean.FalseString, Boolean.
TrueString
, or the string literals "false" or "true" (which are case-insensitive), a
FormatException exception is thrown. Passing in a null for the SourceString parame-
ter throws an
ArgumentNullException exception.
When invoking
char.Parse, if a string value containing more than one character is
passed as its single argument, a
FormatException ...