This method converts a String to an SByte in the style specified by NumberFormatInfo. The SByte type is not CLS compliant. The CLS-compliant alternative is Byte.
[C#] public static sbyte Parse( string s, NumberStyles style, NumberFormatInfo info ); [C++] public: static char Parse( String* s, NumberStyles style, NumberFormatInfo* info ); [JScript] public static function Parse( s : String, style : NumberStyles, info : NumberFormatInfo ) : 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 style parameter must be a combination of bit flags from the NumberStyles enumeration.
If the info parameter is null 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 Parse methods do not accept not a number (NaN), or positive or negative infinity.
SByte Structure | SByte Members | System Namespace | SByte.Parse Overload List | String | NumberFormatInfo | NaN | NaN | PositiveInfinity | PositiveInfinity | NegativeInfinity | NegativeInfinity