Converting strings/byte arrays to encoded strings

I ran into this problem not to long ago where I needed to round trip strings between a coded format and their normal human readable format.

The basic idea was to take the string, and convert it to a byte array and then make a string representing the values in the byte array.  The resulting string would be used for a query string parameter and a few other things.

An example: If I have two words I would put a | between them.  hello there would be hello|there and the coded form would be 68656C6C6F7C7468657265

After a bit of digging I found a couple of threads on the net that gave me these two bits of code to go both directions.

string coded = new string(Encoding.UTF8.GetBytes(asciiString).SelectMany(x => x.ToString(“X2”).ToCharArray()).ToArray())

And to go back to the normal string

string notcoded = Encoding.UTF8.GetString(Enumerable.Range(0, hexString.Length / 2).Select(x => Byte.Parse(hexString.Substring(2 * x, 2), NumberStyles.HexNumber)).ToArray())

Not to bad at all with the LINQ in there, before that was around there were loops to get the whole thing done.