Char is 2 byte in .NET because that is how big a Unicode character is. The best thing to do is take the value in as a
byte datatype and use the Convert.ToChar() method on that input value.
I just tried it with this code, and you'll see it produces an "H":
using System;
namespace Unicode_test
{
class Program
{
static void Main(string[] args)
{
byte myByte = 0x48; // 'H' in ASCII, single byte
char myChar = Convert.ToChar(myByte); // should still be 'H"
Console.WriteLine(myChar);
Console.ReadLine();
}
}
}
Reputation Points: 186
Solved Threads: 147
Cookie... That's it
Offline 2,519 posts
since Dec 2003