public void TrimExcess() { var deque = new Deque<int>(); deque.TrimExcess(); deque = new Deque<int>(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }); deque.TrimExcess(); deque.Clear(); deque.TrimExcess(); }