Convert.ToChar(); Method in C#
This technique is utilized to convert the value of the predefined object to its equivalent Unicode character.so let' see the program below which demonstrates Convert.ToChar(); Method.
Program
using System;
namespace To_char_Program
{
class program
{
static void Main(string[] args)
{
foreach (byte value in All_Bytes )
{
get_char = Convert.ToChar(value);
Console.WriteLine("Value( {0} )converted to character( {1} )", value,get_char);
}
Console.WriteLine("\nPress Enter to exit");
Console.Read();
}
}
Output
This technique is utilized to convert the value of the predefined object to its equivalent Unicode character.so let' see the program below which demonstrates Convert.ToChar(); Method.
Program
using System;
namespace To_char_Program
{
class program
{
static void Main(string[] args)
{
byte[] All_Bytes= { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90};
char get_char;foreach (byte value in All_Bytes )
{
get_char = Convert.ToChar(value);
Console.WriteLine("Value( {0} )converted to character( {1} )", value,get_char);
}
Console.WriteLine("\nPress Enter to exit");
Console.Read();
}
}
Output