Microsoft.Protocols.TestSuites.Common.BufferReader.ReadByte C# (CSharp) Method

ReadByte() public method

Reads a byte from the current position and advances the current position of the buffer by one byte.
public ReadByte ( ) : byte
return byte
        public byte ReadByte()
        {
            if (this.position >= this.length)
            {
                throw new Exception("bufferReader out of bound.");
            }

            return this.buffer[this.position++];
        }

Usage Example

        /// <summary>
        /// Deserialized byte array to a Restriction instance
        /// </summary>
        /// <param name="buffer">Byte array contain data of a Restriction instance.</param>
        /// <returns>Bytes count that deserialized in buffer.</returns>
        public override uint Deserialize(byte[] buffer)
        {
            BufferReader reader = new BufferReader(buffer);
            this.RestrictType = (RestrictionType)reader.ReadByte();
            this.propTag.PropertyType = reader.ReadUInt16();
            this.propTag.PropertyId = reader.ReadUInt16();

            return reader.Position;
        }
All Usage Examples Of Microsoft.Protocols.TestSuites.Common.BufferReader::ReadByte