public override void WriteBinHex(byte[] buffer, int index, int count)
{
if (buffer == null)
{
throw new ArgumentNullException(nameof(buffer));
}
// Not checking upper bound because it will be caught by "count". This is what XmlTextWriter does.
if (index < 0)
{
throw new ArgumentOutOfRangeException(nameof(index), SR.ValueMustBeNonNegative);
}
if (count < 0)
{
throw new ArgumentOutOfRangeException(nameof(count), SR.ValueMustBeNonNegative);
}
if (count > buffer.Length - index)
{
throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.JsonSizeExceedsRemainingBufferSpace, buffer.Length - index));
}
StartText();
WriteEscapedJsonString(BinHexEncoding.GetString(buffer, index, count));
}