예제 #1
0
        public byte ReadByte()
        {
            //would be -1 if it's invalid
            int b = ManagedStream.ReadByte();

            //TODO: Contract interface doesn't mention throwing in this case. Should we throw?
            if (b == -1)
            {
                throw new InvalidOperationException("Failed to read a desired byte from the stream.");
            }

            return((byte)b);
        }