public static void Main()
var items = new Dequeue(10);
for (var index = 0; index < 10; index++)
Console.WriteLine($"{index}:{items[index]}");
public Dequeue(int capacity)
_items = new int[capacity];
public int this[int index]
return _count == _items.Length;
public void AddLeft(int value)
Resize(_items.Length * 2);
_head = _head <= 0 ? _items.Length - 1 : _head - 1;
public void AddRight(int value)
Resize(_items.Length * 2);
_tail = _tail >= _items.Length ? 0 : _tail + 1;
private void Resize(int capacity)