A codec for a hexadecimal string, Encode and Decode. Adds the extension method ToHexString to encode a byte array and ToHexBuffer to decode a hexadecimal string.
public void InvalidHexStrings() { ExceptionAssert.Throws <InvalidDataException>(() => HexString.Decode("0")); ExceptionAssert.Throws <InvalidDataException>(() => HexString.Decode("0Z")); }
public void InvalidFormatSpecifier() { ExceptionAssert.Throws <FormatException>(() => HexString.Encode(new byte[0], "...")); }