ToString Method
Collapse the table of content
Expand the table of content

Byte.ToString Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Converts the value of the current Byte object to its equivalent string representation.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public override string ToString()

Return Value

Type: System.String
The string representation of the value of this object, which consists of a sequence of digits that range from 0 to 9 with no leading zeroes.

The return value is formatted with the general numeric format specifier ("G") and the NumberFormatInfo object for the thread current culture. To define the formatting of the Byte value's string representation, call the ToString method. To define both the format specifiers and culture used to create the string representation of a Byte value, call the ToString method.

For information about the thread current culture, see Thread.CurrentCulture.

The following example uses the ToString() method to display an array of byte values to the console.


byte[] bytes = { 0, 1, 14, 168, 255 };
foreach (byte byteValue in bytes)
   outputBlock.Text += byteValue + "\n";
// The example displays the following output if the current
// culture is en-US:
//       0
//       1
//       14
//       168
//       255


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2016 Microsoft