Byte Array to Hexadecimal String Conversion Another journey down the difficult path! I'd like to know if there's anything I haven't accounted for, if this can be significantly improved, etc.

(Just as a side-note, I know that some of the formatting is a bit off; some places are spaced out a bit to make it more visually appealing.)

using System;

namespace Data
{
    public class BinaryHelper
    {
        public static string ByteToHexString (byte[] bytes)
        {
            char[] c = new char[bytes.Length * 2];
            byte b;

            for (int i = 0; i &lt; bytes.Length; i++) {
                b = ((byte)(bytes [i] &gt;&gt; 4));
                c [i * 2] = (char)(b &gt; 9 ? b + 0x37 : b + 0x30);
                b = ((byte)(bytes [i] &amp; 0xF));
                c [i * 2 + 1] = (char)(b &gt; 9 ? b + 0x37 : b + 0x30);
            }

            return new string (c);
        }

        public static byte[] HexStringToByte (string hex)
        {
            int len = hex.Length;
            byte[] bytes = new byte[len / 2];

            for (int i = 0; len &gt; i; i += 2) {
                bytes [i / 2] = Convert.ToByte (hex.Substring (i, 2), 16);
            }

            return bytes;
        }
    }
}
Ask yourself "how can I make the meaning and intention of the code more clear?"

Consider making small helper methods rather than duplicating code:

static byte HighNibble(byte b) =&gt; (byte)(b &gt;&gt; 4);
static byte LowNibble(byte b) =&gt; (byte)(b &amp; 0xF);
static char NibbleToHex =&gt; ... etc.


And now instead of

    b = ((byte)(bytes [i] &gt;&gt; 4));
    c [i * 2] = (char)(b &gt; 9 ? b + 0x37 : b + 0x30)
    b = ((byte)(bytes [i] &amp; 0xF));
    c [i * 2 + 1] = (char)(b &gt; 9 ? b + 0x37 : b + 0x30);


Which is overwhelming in the sheer amount of punctuation, we have:

 c [i * 2] = NibbleToHex(HighNibble(bytes[i])); 
 c [i * 2 + 1] = NibbleToHex(LowNibble(bytes[i]));


So much easier to read and understand.