public void TestToFromHexPartial()
        {
            const string hex = "0102030405060708090a0b0c0d0e0f10";

            byte[] bin = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };

            Assert.AreEqual(hex.Substring(4, 10), HexEncoding.EncodeBytes(bin, 2, 5));
            Assert.AreEqual(0, BinaryComparer.Compare(new byte[] { 3, 4, 5, 6 }, HexEncoding.DecodeBytes(hex, 4, 8)));
        }
        public void TestToFromHex()
        {
            byte[] all = new byte[256];
            for (int i = 0; i < all.Length; i++)
            {
                all[i] = (byte)i;
            }

            Assert.AreEqual(AllHex, HexEncoding.EncodeBytes(all));
            Assert.AreEqual(0, BinaryComparer.Compare(all, HexEncoding.DecodeBytes(AllHex)));
            Assert.AreEqual(0, BinaryComparer.Compare(all, HexEncoding.DecodeBytes(AllHex.ToUpper())));
        }