C#堆栈队列组合 [英] c# stack queue combination
本文介绍了C#堆栈队列组合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有在C#,可以在同一时间被用作堆栈和队列一些已定义一般容器?
我只是希望能够追加要素要么到最后,还是要排队。
感谢
的前面< DIV CLASS =h2_lin>解决方案
检查 LinkedList的类
的LinkedList< INT>名单=新的LinkedList<&诠释GT;();
list.AddFirst(1);
list.AddLast(2);
list.AddFirst(0);
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);
这篇关于C#堆栈队列组合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文