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

WriteLong() public static method

Writes a signed 64-bit integer value to a buffer.
public static WriteLong ( System.ByteBuffer buffer, long value, bool smallEncoding ) : void
buffer System.ByteBuffer The buffer to write.
value long The signed 64-bit integer value.
smallEncoding bool if true, try using small encoding if possible.
return void
        public static void WriteLong(ByteBuffer buffer, long value, bool smallEncoding)
        {
            if (smallEncoding && value >= sbyte.MinValue && value <= sbyte.MaxValue)
            {
                AmqpBitConverter.WriteUByte(buffer, FormatCode.SmallLong);
                AmqpBitConverter.WriteByte(buffer, (sbyte)value);
            }
            else
            {
                AmqpBitConverter.WriteUByte(buffer, FormatCode.Long);
                AmqpBitConverter.WriteLong(buffer, value);
            }
        }