本文介绍了C#添加删除(INT指数)方法将.NET Queue类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用泛型队列类在.NET框架(3.5)
描述,但我需要一个删除(INT指数)方法从队列中删除的项目。我可以实现与扩展方法这个功能?任何人都关心我指出了正确的方向。

I would like to use the generic queue class as described in the .NET framework (3.5)but I will need a Remove(int index) method to remove items from the queue. Can I achieve this functionality with an extension method? Anyone care to point me in the right direction?

推荐答案

你想要的是一个的,您随时来电的当你想从<$ C获得该项目$ C>队列。其他一切都是一样的,真​​的(调用添加将项目添加到队列的末尾)。

What you want is a List<T> where you always call RemoveAt(0) when you want to get the item from the Queue. Everything else is the same, really (calling Add would add an item to the end of the Queue).

这篇关于C#添加删除(INT指数)方法将.NET Queue类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 12:19