System.Runtime.Serialization.Json.XmlJsonWriter.WriteBinHex C# (CSharp) Method

WriteBinHex() public method

public WriteBinHex ( byte buffer, int index, int count ) : void
buffer byte
index int
count int
return void
        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));
        }