Converts a string to a value in the specified base, represented as an 8-bit unsigned Byte.
[Visual Basic] Overridable Public Function ToByte() As Byte [C#] public virtual byte ToByte(); [C++] public: virtual unsigned char ToByte(); [JScript] public function ToByte() : Byte;
The unsigned byte representation of the string as a base number.
Exception Type | Condition |
---|---|
ArgumentException | If the string is not base 2, 8, 10, or 16. |
FormatException | If the string cannot be parsed as a base number. |
ArgumentNullException | If the string is null. |
OverflowException | If the string is greater than Byte.MaxValue or less than Byte.MinValue. |
If the number is 16, the number may be preceded by "0x"; any other leading or trailing character causes an error.
The ToByte implementation is the same as ToByte. (In addition information, see Byte, Convert and Value.)