Determines the styles permitted in numeric string arguments that are passed to the Parse and TryParse methods of the integral and floating-point numeric types.

Hierarchy (view full)

Properties

AllowCurrencySymbol: NumberStyles

Indicates that the numeric string can contain a currency symbol. Valid currency symbols are determined by the System.Globalization.NumberFormatInfo.CurrencySymbol property.

AllowDecimalPoint: NumberStyles

Indicates that the numeric string can have a decimal point. If the System.Globalization.NumberStyles value includes the System.Globalization.NumberStyles.AllowCurrencySymbol flag and the parsed string includes a currency symbol, the decimal separator character is determined by the System.Globalization.NumberFormatInfo.CurrencyDecimalSeparator property. Otherwise, the decimal separator character is determined by the System.Globalization.NumberFormatInfo.NumberDecimalSeparator property.

AllowExponent: NumberStyles

Indicates that the numeric string can be in exponential notation. The System.Globalization.NumberStyles.AllowExponent flag allows the parsed string to contain an exponent that begins with the "E" or "e" character and that is followed by an optional positive or negative sign and an integer. In other words, it successfully parses strings in the form nnnExx, nnnE+xx, and nnnE-xx. It does not allow a decimal separator or sign in the significand or mantissa; to allow these elements in the string to be parsed, use the System.Globalization.NumberStyles.AllowDecimalPoint and System.Globalization.NumberStyles.AllowLeadingSign flags, or use a composite style that includes these individual flags.

AllowHexSpecifier: NumberStyles

Indicates that the numeric string represents a hexadecimal value. Valid hexadecimal values include the numeric digits 0-9 and the hexadecimal digits A-F and a-f. Strings that are parsed using this style cannot be prefixed with "0x" or "&h". A string that is parsed with the System.Globalization.NumberStyles.AllowHexSpecifier style will always be interpreted as a hexadecimal value. The only flags that can be combined with System.Globalization.NumberStyles.AllowHexSpecifier are System.Globalization.NumberStyles.AllowLeadingWhite and System.Globalization.NumberStyles.AllowTrailingWhite. The System.Globalization.NumberStyles enumeration includes a composite style, System.Globalization.NumberStyles.HexNumber, that consists of these three flags.

AllowLeadingSign: NumberStyles

Indicates that the numeric string can have a leading sign. Valid leading sign characters are determined by the System.Globalization.NumberFormatInfo.PositiveSign and System.Globalization.NumberFormatInfo.NegativeSign properties.

AllowLeadingWhite: NumberStyles

Indicates that leading white-space characters can be present in the parsed string. Valid white-space characters have the Unicode values U+0009, U+000A, U+000B, U+000C, U+000D, and U+0020. Note that this is a subset of the characters for which the System.Char.IsWhiteSpace|IsWhiteSpace(c) method returns true.

AllowParentheses: NumberStyles

Indicates that the numeric string can have one pair of parentheses enclosing the number. The parentheses indicate that the string to be parsed represents a negative number.

AllowThousands: NumberStyles

Indicates that the numeric string can have group separators, such as symbols that separate hundreds from thousands. If the System.Globalization.NumberStyles value includes the System.Globalization.NumberStyles.AllowCurrencySymbol flag and the string to be parsed includes a currency symbol, the valid group separator character is determined by the System.Globalization.NumberFormatInfo.CurrencyGroupSeparator property, and the number of digits in each group is determined by the System.Globalization.NumberFormatInfo.CurrencyGroupSizes property. Otherwise, the valid group separator character is determined by the System.Globalization.NumberFormatInfo.NumberGroupSeparator property, and the number of digits in each group is determined by the System.Globalization.NumberFormatInfo.NumberGroupSizes property.

AllowTrailingSign: NumberStyles

Indicates that the numeric string can have a trailing sign. Valid trailing sign characters are determined by the System.Globalization.NumberFormatInfo.PositiveSign and System.Globalization.NumberFormatInfo.NegativeSign properties.

AllowTrailingWhite: NumberStyles

Indicates that trailing white-space characters can be present in the parsed string. Valid white-space characters have the Unicode values U+0009, U+000A, U+000B, U+000C, U+000D, and U+0020. Note that this is a subset of the characters for which the System.Char.IsWhiteSpace|IsWhiteSpace(c) method returns true.

Indicates that all styles except System.Globalization.NumberStyles.AllowHexSpecifier are used. This is a composite number style.

Currency: NumberStyles

Indicates that all styles except System.Globalization.NumberStyles.AllowExponent and System.Globalization.NumberStyles.AllowHexSpecifier are used. This is a composite number style.

HexNumber: NumberStyles
Integer: NumberStyles

Indicates that no style elements, such as leading or trailing white space, thousands separators, or a decimal separator, can be present in the parsed string. The string to be parsed must consist of integral decimal digits only.

Number: NumberStyles

Methods

  • Casts this object to the specified type. Throws error on failure.

    Type Parameters

    • T1

      The target type of the cast.

    • T2

      The type of the object to cast.

    Parameters

    Returns T1

  • Determines whether the specified object is equal to the current object.

    Parameters

    • obj: any

      The object to compare with the current object.

    Returns boolean

    true if the specified object is equal to the current object; otherwise, false.

  • Serves as the default hash function.

    Returns number

    A hash code for the current object.

  • Determines whether one or more bit fields are set in the current instance.

    Parameters

    • flag: Enum

      An enumeration value.

    Returns boolean

    true if the bit field or bit fields that are set in flag are also set in the current instance; otherwise, false.

  • Returns a string that represents the current object.

    Returns string

    A string that represents the current object.

  • Casts this object to the specified type. Returns null on failure.

    Type Parameters

    • T1

      The target type of the cast.

    • T2

      The type of the object to cast.

    Parameters

    Returns null | T1

  • Determines whether the specified object instances are considered equal.

    Parameters

    • objA: any

      The first object to compare.

    • objB: any

      The second object to compare.

    Returns boolean

    true if the objects are considered equal; otherwise, false. If both objA and objB are null, the method returns true.

Default capability

  • Perform And operation on enum values.

    Parameters

    • Rest...rest: Enum[]

      The other enum values.

    Returns this

    The result.

    2.0

  • Perform Or operation on enum values.

    Parameters

    • Rest...rest: Enum[]

      The other enum values.

    Returns this

    The result.

    2.0

  • Perform Xor operation on enum values.

    Parameters

    • Rest...rest: Enum[]

      The other enum values.

    Returns this

    The result.

    2.0