System.IO.BinaryReader.Read C# (CSharp) Method

Read() public method

public Read ( byte buffer, int index, int count ) : int
buffer byte
index int
count int
return int
        public virtual int Read(byte[] buffer, int index, int count)
        {
            if (buffer == null)
            {
                throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
            }
            if (index < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_NeedNonNegNum);
            }
            if (count < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
            }
            if (buffer.Length - index < count)
            {
                throw new ArgumentException(SR.Argument_InvalidOffLen);
            }
            if (_stream == null)
            {
                throw new ObjectDisposedException(null, SR.ObjectDisposed_FileClosed);
            }

            return _stream.Read(buffer, index, count);
        }

Same methods

BinaryReader::Read ( ) : int
BinaryReader::Read ( char buffer, int index, int count ) : int

Usage Example

Example #1
0
        public ExexEntry(BinaryReader reader)
            : this()
        {
            auraId = reader.ReadUInt16();
            auraSlot = reader.ReadUInt16();

            particleColor = readColor(reader);
            reader.Read(data1, 0, data1.Length);

            outerGlowColor = readColor(reader);
            innerGlowColor = readColor(reader);
            reader.Read(data2, 0, data2.Length);

            smoke1Color = readColor(reader);
            smoke1Invert = reader.ReadByte() != COLOR_NOT_INVERTED;
            reader.Read(data3, 0, data3.Length);

            smoke2Color = readColor(reader);
            smoke2Invert = reader.ReadByte() != COLOR_NOT_INVERTED;
            reader.Read(data4, 0, data4.Length);

            boltsColor = readColor(reader);
            boltsInvert = reader.ReadByte() != COLOR_NOT_INVERTED;
            reader.Read(data5, 0, data5.Length);
        }
All Usage Examples Of System.IO.BinaryReader::Read