public static string HexEscape (char character) { if (character > 255) { throw new ArgumentOutOfRangeException ("character"); } return "%" + hexUpperChars [((character & 0xf0) >> 4)] + hexUpperChars [((character & 0x0f))]; }