Skip to content

Instantly share code, notes, and snippets.

@grnde
grnde / CircularStack.IEnumerable.cs
Last active March 6, 2020 21:28
My current implementation of a stack that forgets the oldest element if the maximum capacity is reached.
public partial class CircularStack<T>
{
IEnumerator<T> IEnumerable<T>.GetEnumerator()
=> new Enumerator(this);
IEnumerator IEnumerable.GetEnumerator()
=> new Enumerator(this);
/// <summary>
/// Implements <see cref="IEnumerator{T}"/> for a <see cref="CircularStack{T}"/>.