Unfortunately, you cannot directly use the plain old .NET Queue
object. The queue is executed for the blind first-in-first-end logic, so you cannot execute anything but this.
If you really need to implement a queue in which you can find the elements and get their position (a very useful thing), try wrapping everything in a class that provides the following methods:
public class CustomQueue<T> { private LinkedList<T> fifoList = new LinkedList<T>(); public Enqueue(T newItem) {
To improve performance (queue and dequeue O (1), while indexOf O (n)), you should use a double-linked list
source share