c# stack queue combination

前端 未结 5 1724
南方客
南方客 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:08

    Good old List will do it.

    Add() to enqueue, Insert(0,T) to push, Remove(0) to pop/dequeue.

提交回复
热议问题