Tried these two:
static readonly string hex = "0123456789ABCDEF";
/// <summary>
/// Converts Byte to a Hexadecimal string, like .ToString("X2") would do;
/// </summary>
/// <param name="number">Byte to represent has a hexadecimal string.</param>
/// <returns>2 character string of hexadecimal representation of the number</returns>
public static string FromByteToHex(byte number)
{
return new string(new char[] { hex[(number & 0xF0) >> 4], hex[number & 0x0F] });
}
public static void Main()
{
string s = FromByteToHex(193);
string f = 193.ToString("X2");
...
}
Works both ways in emulator