ICircularBuffer

Ecng.Collections

Common interface for circular buffers.

Implements: IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable

Properties

Capacity
public int Capacity { get; set; }
value = iCircularBuffer.Capacity
iCircularBuffer.Capacity = value

Maximum capacity of the buffer.

Methods

Back
public T Back()
result = iCircularBuffer.Back()

Element at the back of the buffer - this[Size - 1].

Returns: The value of the element of type T at the back of the buffer.

Front
public T Front()
result = iCircularBuffer.Front()

Element at the front of the buffer - this[0].

Returns: The value of the element of type T at the front of the buffer.

PopBack
public void PopBack()
iCircularBuffer.PopBack()

Removes the element at the back of the buffer. Decreasing the Buffer size by 1.

PopFront
public void PopFront()
iCircularBuffer.PopFront()

Removes the element at the front of the buffer. Decreasing the Buffer size by 1.

PushBack
public void PushBack(T item)
iCircularBuffer.PushBack(item)

Pushes a new element to the back of the buffer. Back()/this[Size-1] will now return this element. When the buffer is full, the element at Front()/this[0] will be popped to allow for this new element to fit.

item
Item to push to the back of the buffer
PushFront
public void PushFront(T item)
iCircularBuffer.PushFront(item)

Pushes a new element to the front of the buffer. Front()/this[0] will now return this element. When the buffer is full, the element at Back()/this[Size-1] will be popped to allow for this new element to fit.

item
Item to push to the front of the buffer