class Program
{
static void Main(string[] args)
{
string[] cars = new string[] { "宝马", "奔驰", "奥迪", "东风", "劳斯莱斯" };
Queue<string> aa = new Queue<string>();
Console.WriteLine("开始入队列:");
foreach (var item in cars)
{
aa.Enqueue(item);
Console.WriteLine(item);
Console.WriteLine("入队列-{0}",item);
}
Console.WriteLine();
PrintQueue(aa);
Console.WriteLine();
Console.WriteLine("开始出队列:");
while (aa.Count>0)
{
string str = aa.Dequeue();
}
Console.ReadKey();
}
private static void PrintQueue(Queue<string> list)
{
Console.WriteLine("开始打印队列:");
foreach (string str in list)
{
Console.WriteLine(str);
}
}
}