打赏
摘要: var thread = new Thread(ThreadDo);//ThreadDo是调用COM组件的方法 thread.SetApartmentState(ApartmentState.STA); thread.IsBackgound=True; thread.Start(); 阅读全文
posted @ 2019-08-04 08:26 DanielXiaoyc 阅读(316) 评论(0) 推荐(0)
摘要: private void Do() { Task[] tasks = new Task[1]; Task task = new Task((param) => { }); tasks[0] = task; task.Start(); Task.WaitAll(tasks);//阻塞主线程 Task. 阅读全文
posted @ 2019-08-04 08:21 DanielXiaoyc 阅读(1664) 评论(0) 推荐(0)
摘要: 线程方法定义: public void ThreadDo(string param) 线程方法定义: public void ThreadDo(string param) { { } 线程方法调用: Thread thread = new Thread(() => ThreadDo("param1" 阅读全文
posted @ 2019-08-04 08:12 DanielXiaoyc 阅读(638) 评论(0) 推荐(0)