Converts a String to an SByte in the specified style. The SByte type is not CLS compliant. The CLS-compliant alternative is Byte.
[C#] public static sbyte Parse( string s, NumberStyles style ); [C++] public: static char Parse( String* s, NumberStyles style ); [JScript] public static function Parse( s : String, style : NumberStyles ) : SByte;
[Visual Basic] The SByte type cannot be used in Visual Basic.
Returns an SByte with the value represented by s.
Exception Type | Condition |
---|---|
ArgumentNullException | If s is a null reference (in Visual Basic Nothing). |
ArgumentException | If style is not a combination of bit flags from the NumberStyles enumeration. |
FormatException | If s is not of the correct format. |
OverflowException | If s represents a number that is less than SByte.MinValue or greater than SByte.MaxValue. |
The numeric format information is obtained from the current locale (see NumberFormatInfo and CultureInfo for number and culture specific formatting).
If s has been created by one of the Format methods using C, D, E, F, G, or N as the format specifier, it is guaranteed that s can be parsed when style is NumberStyles enumeration .
Note The SByte.Parse methods do not accept not a number (NaN), or positive or negative infinity.
The style parameter must be a combination of bit flags from the NumberStyles enumeration.
SByte Structure | SByte Members | System Namespace | SByte.Parse Overload List | NaN | NaN | String | MinValue | MaxValue | PositiveInfinity | PositiveInfinity | NegativeInfinity | NegativeInfinity