c# stack queue combination
is there in C# some already defined generic container which can be used as Stack and as Queue at the same time? I just want to be able to append elements either to the end, or to the front of the queue thanks Check the LinkedList class. LinkedList<int> list = new LinkedList<int>(); list.AddFirst(1); list.AddLast(2); list.AddFirst(0); Here's my implementation of an immutable deque : http://blogs.msdn.com/ericlippert/archive/2008/02/12/immutability-in-c-part-eleven-a-working-double-ended-queue.aspx Notice that this is an immutable double-ended-queue. Normally you probably think of a queue as