I'm reading an integer from the memory (i below). To convert it in to the character that I'm after I do the following:
int i = 99;
string hex = 99.ToString("X"); //"63"
string readable = hex.FromHex(); //"c"
public static string FromHex(this string hex)
{
hex = hex.Replace("-", "");
byte[] raw = new byte[hex.Length / 2];
for (int i = 0; i < raw.Length; i++)
{
raw[i] = Convert.ToByte(hex.Substring(i * 2, 2), 16);
}
return Encoding.UTF8.GetString(raw);
}
But I suppose there is an easier way to accomplish this?