using System.Collections; static void Main(string[] args) { TestQueue(); } //------------------------------------------------------ // 队列(Queue) public static void TestQueue() { Queue q = new Queue(); q.Enqueue('A'); q.Enqueue('B'); q.Enqueue('C'); q.Enqueue('D'); Console.WriteLine("当前队列e: "); foreach (char c in q) Console.Write(c + " "); Console.WriteLine(); q.Enqueue('E'); q.Enqueue('F'); Console.WriteLine("当前队列: "); foreach (char c in q) Console.Write(c + " "); Console.WriteLine(); Console.WriteLine("开始出队 "); char ch = (char)q.Dequeue(); Console.WriteLine("出队: {0}", ch); ch = (char)q.Dequeue(); Console.WriteLine("出队: {0}", ch); Console.ReadKey(); Console.ReadLine(); } //------------------------------------------------------