假设
Queue<String> aQueue =new Queue<string>();
Customer aCustomer=new Customer();
我使用aCustomer
将aCustomer
排入队列。(多个值)
我如何取消aCustomer
并将这些值放入aCustomer
。(多个变量)。
如果有人有解决方案,请帮助我。
答案 0 :(得分:2)
Queue<Customer> aQueue =new Queue<Customer>();
Customer aCustomer=new Customer();
aQueue.Enqueue(aCustomer);
aCustomer = aQueue.Dequeue();
答案 1 :(得分:0)
你在找这样的东西吗?
Queue<Customer> aQueue = new Queue<Customer>();
Customer customer = new Customer { Name = "Test" };
aQueue.Enqueue(customer);
customer = new Customer { Name = "Test1" };
aQueue.Enqueue(customer);
customer = new Customer { Name = "Test2" };
aQueue.Enqueue(customer);
while (aQueue.Any())
{
customer = aQueue.Dequeue();
// use customer
}