private void button_测试Queue结合多线程_Click(object sender, EventArgs e)
{
Console.WriteLine("初始化队列");
queue = new Queue<string>();
string[] cars = new string[]{"宝马","奔驰",
"奥迪","东风","劳斯莱斯"};
foreach (string str in cars)
{
queue.Enqueue(str);
Console.WriteLine("入队列-{0}", str);
}
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Red;
Thread th = new Thread(new ThreadStart(printQueue));
th.IsBackground = true; //后台运行,主窗体关闭后,可退出程序
th.Start();
}
private void printQueue()
{
while (true)
{
if (queue.Count > 0)
{
Console.WriteLine("出队列-{0}", queue.Dequeue());
}
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有