Class RingBuffer<T>
- Namespace
- DisCatSharp
- Assembly
- DisCatSharp.dll
A circular buffer collection.
public class RingBuffer<T> : ICollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
T
Type of elements within this ring buffer.
- Inheritance
-
RingBuffer<T>
- Implements
-
ICollection<T>IEnumerable<T>
- Inherited Members
Constructors
- RingBuffer(IEnumerable<T>)
Creates a new ring buffer, filled with specified elements.
- RingBuffer(IEnumerable<T>, int)
Creates a new ring buffer, filled with specified elements, and starting at specified index.
- RingBuffer(int)
Creates a new ring buffer with specified size.
Properties
- Capacity
Gets the capacity of this ring buffer.
- Count
Gets the number of items in this ring buffer.
- CurrentIndex
Gets the current index of the buffer items.
- InternalBuffer
Gets or sets the internal collection of items.
- IsReadOnly
Gets whether this ring buffer is read-only.
Methods
- Add(T)
Inserts an item into this ring buffer.
- Clear()
Clears this ring buffer and resets the current item index.
- Contains(Func<T, bool>)
Checks whether given item is present in the buffer using given predicate to find it.
- Contains(T)
Checks whether given item is present in the buffer. This method is not implemented. Use Contains(Func<T, bool>) instead.
- CopyTo(T[], int)
Copies this ring buffer to target array, attempting to maintain the order of items within.
- GetEnumerator()
Returns an enumerator for this ring buffer.
- Remove(Func<T, bool>)
Removes an item from the buffer using given predicate to find it.
- Remove(T)
Removes an item from the buffer. This method is not implemented. Use Remove(Func<T, bool>) instead.
- TryGet(Func<T, bool>, out T)
Gets first item from the buffer that matches the predicate.
Explicit Interface Implementations
- IEnumerable.GetEnumerator()
Returns an enumerator for this ring buffer.