Пример #1
0
        /// <summary>
        /// Writes a BSON Double to the writer.
        /// </summary>
        /// <param name="value">The Double value.</param>
        public override void WriteDouble(double value)
        {
            if (Disposed)
            {
                throw new ObjectDisposedException("BsonBinaryWriter");
            }
            if (State != BsonWriterState.Value)
            {
                ThrowInvalidState("WriteDouble", BsonWriterState.Value);
            }

            _buffer.WriteByte((byte)BsonType.Double);
            WriteNameHelper();
            _buffer.WriteDouble(value);

            State = GetNextState();
        }
Пример #2
0
        /// <summary>
        /// Writes a BSON Double to the writer.
        /// </summary>
        /// <param name="value">The Double value.</param>
        public override void WriteDouble(
            double value
            )
        {
            if (disposed)
            {
                throw new ObjectDisposedException("BsonBinaryWriter");
            }
            if (state != BsonWriterState.Value)
            {
                var message = string.Format("WriteDouble cannot be called when State is: {0}", state);
                throw new InvalidOperationException(message);
            }

            buffer.WriteByte((byte)BsonType.Double);
            WriteNameHelper();
            buffer.WriteDouble(value);

            state = GetNextState();
        }