Class OptimizedCapacity2Buffer<T>
- Namespace
- AlgorithmsSW.Buffer
- Assembly
- AlgorithmsSW.dll
Represents a buffer with a fixed capacity of two items.
public sealed class OptimizedCapacity2Buffer<T> : IBuffer<T?>, IEnumerable<T?>, IEnumerable, IPair<T>
Type Parameters
T
The type of items contained in the buffer.
- Inheritance
-
OptimizedCapacity2Buffer<T>
- Implements
-
IBuffer<T>IEnumerable<T>IPair<T>
- Inherited Members
- Extension Methods
Properties
Capacity
Gets the maximum number of elements the buffer can hold.
public int Capacity { get; }
Property Value
Count
Gets the current number of elements in the buffer.
public int Count { get; }
Property Value
First
Represents a generic buffer interface.
public T? First { get; }
Property Value
- T
HasPreviousValue
Gets a value indicating whether this buffer has a previous value.
public bool HasPreviousValue { get; }
Property Value
HasValue
Gets a value indicating whether this buffer has a value.
public bool HasValue { get; }
Property Value
IsFull
Gets a value indicating whether the buffer is full.
public bool IsFull { get; }
Property Value
Last
Represents a generic buffer interface.
public T? Last { get; }
Property Value
- T
Methods
Clear()
Clears all items from the buffer.
public void Clear()
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<T?> GetEnumerator()
Returns
- IEnumerator<T>
An enumerator that can be used to iterate through the collection.
Insert(T?)
Inserts an item into the buffer.
public void Insert(T? item)
Parameters
item
TThe item to insert into the buffer.