NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Convert.ToByte (String, Int32)

Converts a String to a value in the specified base, represented as an 8-bit unsigned byte.

[Visual Basic]
Overloads Public Shared Function ToByte( _
   ByVal value As String, _
   ByVal fromBase As Integer _
) As Byte
[C#]
public static byte ToByte(
   string value,
   int fromBase
);
[C++]
public: static unsigned char ToByte(
   String* value,
   int fromBase
);
[JScript]
public static function ToByte(
   value : String,
   fromBase : int
) : Byte;

Parameters

value
The String to be parsed.
fromBase
The base in which to parse value.

Return Value

The unsigned byte representation of value as a base fromBase number.

Exceptions

Exception Type Condition
ArgumentException fromBase is not 2, 8, 10, or 16.
FormatException value cannot be parsed as a base fromBase number.
ArgumentNullException value is null.
OverflowException The value represented by value is greater than Byte.MaxValue or less than Byte.MinValue.

Remarks

If fromBase is 16, the number may be preceded by "0x"; any other leading or trailing character causes an error.

See Also

Convert Class | Convert Members | System Namespace | Convert.ToByte Overload List