Convert.ToString Method (Byte)

 

Converts the value of the specified 8-bit unsigned integer to its equivalent string representation.

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

public static string ToString(
	byte value
)

Parameters

value
Type: System.Byte

The 8-bit unsigned integer to convert.

Return Value

Type: System.String

The string representation of value.

This implementation is identical to Byte.ToString().

The following example converts each value in a Byte array to a string.

using System;

public class Example
{
   public static void Main()
   {
      byte[] values = { Byte.MinValue, 12, 100, 179, Byte.MaxValue } ;

      foreach (var value in values)
         Console.WriteLine("{0,3} ({1}) --> {2}", value, 
                           value.GetType().Name, 
                           Convert.ToString(value));      
   }
}
// The example displays the following output:
//       0 (Byte) --> 0
//      12 (Byte) --> 12
//     100 (Byte) --> 100
//     179 (Byte) --> 179
//     255 (Byte) --> 255

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: