Amqp.Types.Encoder.ReadBoolean C# (CSharp) Method

ReadBoolean() public static method

Reads a boolean value from a buffer.
public static ReadBoolean ( System.ByteBuffer buffer, byte formatCode ) : bool
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return bool
        public static bool ReadBoolean(ByteBuffer buffer, byte formatCode)
        {
            if (formatCode == FormatCode.BooleanTrue)
            {
                return true;
            }
            else if (formatCode == FormatCode.BooleanFalse)
            {
                return false;
            }
            else if (formatCode == FormatCode.Boolean)
            {
                byte data = AmqpBitConverter.ReadUByte(buffer);
                return data != 0;
            }
            else
            {
                throw InvalidFormatCodeException(formatCode, buffer.Offset);
            }
        }