Convert.ToString Method (Byte)
.NET Framework 4.5
Converts the value of the specified 8-bit unsigned integer to its equivalent string representation.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Parameters
- value
- Type: System.Byte
The 8-bit unsigned integer to convert.
This implementation is identical to Byte.ToString().
The following example converts a Byte to a String.
public void ConvertStringByte(string stringVal) { byte byteVal = 0; try { byteVal = System.Convert.ToByte(stringVal); System.Console.WriteLine("{0} as a byte is: {1}", stringVal, byteVal); } catch (System.OverflowException) { System.Console.WriteLine( "Conversion from string to byte overflowed."); } catch (System.FormatException) { System.Console.WriteLine( "The string is not formatted as a byte."); } catch (System.ArgumentNullException) { System.Console.WriteLine( "The string is null."); } //The conversion from byte to string is always valid. stringVal = System.Convert.ToString(byteVal); System.Console.WriteLine("{0} as a string is {1}", byteVal, stringVal); }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.