Converts a String to a Byte with a specified style.
[Visual Basic] Overloads Public Shared Function Parse( _ ByVal s As String, _ ByVal style As NumberStyles _ ) As Byte [C#] public static byte Parse( string s, NumberStyles style ); [C++] public: static unsigned char Parse( String* s, NumberStyles style ); [JScript] public static function Parse( s : String, style : NumberStyles ) : Byte;
A Byte with the value represented by s.
Exception Type | Condition |
---|---|
ArgumentException | If the style is not a valid combination of bit flags from the NumberStyles enumeration. |
ArgumentNullException | If the string is null. |
FormatException | If the string is not of the correct format. |
FormatException | If the string represents a number that is less than MinValue or greater than MaxValue. |
The numeric format information is obtained from the current locale. (For additional information about current locale or cultures, see CultureInfo.)
Note that the Parse methods do not accept not a number (NaN) or positive or negative infinity.
The s parameter has been created by one of the Format methods using C, D, E, F, G, or N as the format specified, it is guaranteed that s can be parsed when the style is NumberStyles Enumeration.
The style parameter must be a combination of bit flags from the NumberStyles Enumeration, except for NumberStyles.All and NumberStyles.AllowDecimalPoint, which are not valid values for this argument.
Byte Structure | Byte Members | System Namespace | Byte.Parse Overload List