Understanding how queue/stack class works and figuring out why this code isn't working
<p>The first foreach method gets several errors.  I can't figure out why and it seems like it should work...</p>

<p>foreach - invalid token 'foreach' in class, struct, or interface member declaration.</p>

<p>This prints out 1 2 3 4 1 2 3 4 1 2 3 4. </p>

<p>the 2nd foreach method.  How does this work?  I think it just iterates through each number one at a time in order.  The confusion comes in where it is the same code, but stack instead of queue.  The 2nd foreach prints out 4 3 2 1.  Why is this?</p>

<pre><code>namespace Cards
{
    class Class1
    {
        Queue numbers = new Queue();

        foreach (int number in new int[4]{1,2,3,4})
        {
             numbers.Enqueue(number);
            Console.WriteLine(number + " has joined the queue");
        }
        foreach (int number in numbers)
        {
             Console.WriteLine(number);
        }
        while(numbers.Count &gt; 0)
        {
            int number = (int)numbers.Dequeue();
            Console.WriteLine(number + " has left the queue");
        }
    }

}
</code></pre>
