队列
// Initalize a new queue of integers
var queue = new Queue<int>();
// Add some data
queue.Enqueue(6);
queue.Enqueue(4);
queue.Enqueue(9);
// Elements in a queue are stored in "first in, first out" order.
// The queue from first to last is: 6, 4, 9
// View the next element in the queue, without removing it.
Console.WriteLine(queue.Peek()); // prints 6
// Removes the first element in the queue, and returns it.
Console.WriteLine(queue.Dequeue()); // prints 6
Console.WriteLine(queue.Dequeue()); // prints 4
Console.WriteLine(queue.Dequeue()); // prints 9
线程安全抬头! 在多线程环境中使用 ConcurrentQueue 。