c# stack queue combination

前端 未结 5 1723
南方客
南方客 2020-12-29 23:25

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,

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-30 00:09

    Check the LinkedList class.

    LinkedList list = new LinkedList();
    
    list.AddFirst(1);
    list.AddLast(2);
    list.AddFirst(0);
    

提交回复
热议问题