System.Xml.XmlBufferReader.UnsafeReadArray C# (CSharp) Method

UnsafeReadArray() private method

private UnsafeReadArray ( byte dst, int length ) : void
dst byte
length int
return void
        private unsafe void UnsafeReadArray(byte* dst, int length)
        {
            if (_stream != null)
            {
                const int chunk = 256;
                while (length >= chunk)
                {
                    byte[] _buffer = GetBuffer(chunk, out _offset);
                    for (int i = 0; i < chunk; i++)
                    {
                        *dst++ = _buffer[_offset + i];
                    }
                    Advance(chunk);
                    length -= chunk;
                }
            }

            if (length > 0)
            {
                byte[] buffer = GetBuffer(length, out _offset);
                fixed (byte* _src = &buffer[_offset])
                {
                    byte* src = _src;
                    byte* dstMax = dst + length;
                    while (dst < dstMax)
                    {
                        *dst = *src;
                        dst++;
                        src++;
                    }
                }
                Advance(length);
            }
        }

Same methods

XmlBufferReader::UnsafeReadArray ( byte dst, byte dstMax ) : void