How can I modify a queue collection in a loop?
<p>I have a scenario where I  need to remove an item for the queue as soon as been processed.
I understand I cannot remove an item from a collection whilst in loop but was wondering if something
could be done with the Enumerator etc...</p>

<p>This is just a basic example throwing an error 
"Collection was modified after the enumerator was instantiated."</p>

<p>Any suggestions? Thanks a  lot!!!</p>

<p>Code is as follows:</p>

<pre><code>     class Program
        {
            static void Main()
            {

                Queue&lt;Order&gt; queueList = GetQueueList();

                foreach (Order orderItem in queueList)
                {
                    Save(orderItem);
                    Console.WriteLine("Id :{0} Name {1} ", orderItem.Id, orderItem.Name);
                    queueList.Dequeue();
                }
                Console.Read();

            }

            private static void Save(Order orderItem)
            {
               //we are pretending to save or do something.
            }

            private static Queue&lt;Order&gt;GetQueueList()
            {
                Queue&lt;Order&gt; orderQueue = new Queue&lt;Order&gt;();
                orderQueue.Enqueue(new Order { Id = 1, Name = "Order 1" });
                orderQueue.Enqueue(new Order { Id = 1, Name = "Order 2" });
                orderQueue.Enqueue(new Order { Id = 2, Name = "Order 3" });
                orderQueue.Enqueue(new Order { Id = 3, Name = "Order 4" });
                orderQueue.Enqueue(new Order { Id = 4, Name = "Order 5" });
                return orderQueue;
            }
        }

        public  class Order
        {
            public int Id { get; set; }
            public string Name { get; set; }
        }
</code></pre>
