Facebook.Extensions.HexToBytes C# (CSharp) Method

HexToBytes() static private method

static private HexToBytes ( this src ) : byte[]
src this
return byte[]
        internal static byte[] HexToBytes(this string src)
        {
            if (src.Length % 2 == 1)
                src = src.PadLeft(src.Length + 1, '0');

            byte[] result = new byte[src.Length / 2];
            for (int i = 0, s = 0; i < result.Length; i++, s += 2)
            {
                result[i] = byte.Parse(src.Substring(s, 2), NumberStyles.HexNumber);
            }

            return result;
        }