public object Peek() { object return_object; try{ return_object = _ca.Peek(); }catch (Exception) { throw new InvalidOperationException("Queue is empty!"); } return(return_object); }
private void RemoveOverflownBufferEntriesIfAllowed() { if (!RemoveOverflownEntries) { return; } while (_numRows > _maxNumRows) { OutputEntry entry = _entries.Peek(); // Remove entry only if it is completely hidden from view. if (_numRows - entry.Lines.Count >= _maxNumRows) { _numRows -= entry.Lines.Count; _entries.Dequeue(); _entryPool.Release(entry); } else { break; } } }