Class ZeroCapacityBuffer<T>
- Namespace
- AlgorithmsSW.Buffer
- Assembly
- AlgorithmsSW.dll
An IBuffer<T> with zero capacity.
public sealed class ZeroCapacityBuffer<T> : IBuffer<T>, IEnumerable<T>, IEnumerable
Type Parameters
T
The type of element that this buffer could contain.
- Inheritance
-
ZeroCapacityBuffer<T>
- Implements
-
IBuffer<T>IEnumerable<T>
- Inherited Members
- Extension Methods
Remarks
This class is useful to use in algorithms where arbitrary capacity is required that includes 0 capacity.
Only one instance is maintained; get it with <xref href="AlgorithmsSW.Buffer.ZeroCapacityBuffer%601.Instance" data-throw-if-not-resolved="false"></xref>.
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 element in the buffer.
public T First { get; }
Property Value
- T
Instance
Gets the singleton instance of ZeroCapacityBuffer<T>.
public static IBuffer<T> Instance { get; }
Property Value
- IBuffer<T>
Last
Gets the last element in the buffer.
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?)
This method has no effect, since the capacity is 0.
public void Insert(T? item)
Parameters
item
TThe item to insert into the buffer.