Converts a string to an 8-bit unsigned integer with a specified style and format.
[Visual Basic] Overloads Public Shared Function Parse( _ ByVal s As String, _ ByVal style As NumberStyles, _ ByVal info As NumberFormatInfo _ ) As Byte [C#] public static byte Parse( string s, NumberStyles style, NumberFormatInfo info ); [C++] public: static unsigned char Parse( String* s, NumberStyles style, NumberFormatInfo* info ); [JScript] public static function Parse( s : String, style : NumberStyles, info : NumberFormatInfo ) : Byte;
Returns a Byte with the value represented by the string.
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. |
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 specifier, it is guaranteed that s can be parsed when 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.
The info parameter specifies the NumberFormatInfo instance used to format the string. If the info parameter is null, the numeric format information is obtained from the current locale.
Byte Structure | Byte Members | System Namespace | Byte.Parse Overload List