Class Capacity2Buffer<T>
- Namespace
- AlgorithmsSW.Buffer
- Assembly
- AlgorithmsSW.dll
Represents a buffer with a fixed capacity of two items.
public sealed class Capacity2Buffer<T> : IBuffer<T?>, IEnumerable<T?>, IEnumerable, IPair<T>
Type Parameters
T
The type of items contained in the buffer.
- Inheritance
-
Capacity2Buffer<T>
- Implements
-
IBuffer<T>IEnumerable<T>IPair<T>
- Inherited Members
- Extension Methods
Constructors
Capacity2Buffer()
Initializes a new instance of the Capacity2Buffer<T> class.
public Capacity2Buffer()
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
Gets the first item in this Capacity2Buffer<T>.
public T? First { get; }
Property Value
- T
Exceptions
- InvalidOperationException
the container is empty.
HasPreviousValue
Gets a value indicating whether this Capacity2Buffer<T> has a previous value.
public bool HasPreviousValue { get; }
Property Value
HasValue
Gets a value indicating whether this Capacity2Buffer<T> has a value.
public bool HasValue { get; }
Property Value
Last
Gets the last item in this Capacity2Buffer<T>.
public T? Last { get; }
Property Value
- T
Exceptions
- InvalidOperationException
the container is empty.
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.