ToChar Method (Byte)

Convert.ToChar Method (Byte)

 

Converts the value of the specified 8-bit unsigned integer to its equivalent Unicode character.

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

public static char ToChar(
	byte value
)

Parameters

value
Type: System.Byte

The 8-bit unsigned integer to convert.

Return Value

Type: System.Char

A Unicode character that is equivalent to value.

The following example converts an array of unsigned bytes to Char values.

byte[] bytes = {Byte.MinValue, 40, 80, 120, 180, Byte.MaxValue};
char result;
foreach (byte number in bytes)
{
   result = Convert.ToChar(number);
   Console.WriteLine("{0} converts to '{1}'.", number, result);
}
// The example displays the following output:
//       0 converts to ' '.
//       40 converts to '('.
//       80 converts to 'P'.
//       120 converts to 'x'.
//       180 converts to '''.
//       255 converts to 'ÿ'.      

Universal Windows Platform
Available since 4.5
.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:
© 2016 Microsoft