hi all,
i m new in c#.
I dont know how to convert hexadecimal value of a character into its charcter equivalent.
please help me in solving my problem.
thanx in advance.

You need to convert the Hex back into an int then convert the into to a char.

string sHex = "41"; // same as 'A'
byte newByte = byte.Parse(sHex, System.Globalization.NumberStyles.HexNumber);
// newByte now = "65"
int i = Convert.ToInt32(newByte.ToString()); // i now = 65
Char schar = Convert.ToChar(i);
// schar = 'A'

Hope someone else comes up with a better solution.

You need to convert the Hex back into an int then convert the into to a char.

string sHex = "41"; // same as 'A'
byte newByte = byte.Parse(sHex, System.Globalization.NumberStyles.HexNumber);
// newByte now = "65"
int i = Convert.ToInt32(newByte.ToString()); // i now = 65
Char schar = Convert.ToChar(i);
// schar = 'A'

Hope someone else comes up with a better solution.

Thanx A lot ,It works.

This article has been dead for over six months. Start a new discussion instead.