/// <summary> /// Flushes any pending data to the output destination. /// </summary> public override void Flush() { if (Disposed) { throw new ObjectDisposedException("BsonBinaryWriter"); } if (State == BsonWriterState.Closed) { throw new InvalidOperationException("Flush called on closed BsonWriter."); } if (State != BsonWriterState.Done) { throw new InvalidOperationException("Flush called before BsonBinaryWriter was finished writing to buffer."); } _bsonStream.Flush(); }