c#中foreach语句遍历队列(queue)
代码:
复制代码 代码示例:
using System;
using System.Collections;
public class QueuesW3
{
static void Main(string[] args)
{
Queue a = new Queue(10);
int x = 0;
a.Enqueue(x);
x++;
a.Enqueue(x);
foreach (int y in a)
{
Console.WriteLine(y);
}
a.Dequeue();
a.Clear();
}
}