摘要: 1、分析 不能直接用tray-catch处理,需要线程等待(WaitAll),才能捕获到异常 2、异常 多线程异常类:AggregateException 打印异常 foreach (var item in ex.InnerExceptions) { Console.WriteLine(item.M 阅读全文
posted @ 2025-07-05 19:48 市丸银 阅读(18) 评论(0) 推荐(0)
摘要: 1、作用 开启多个线程,且线程相同,阻塞线程 2、For Parallel.For(0, 10, (i) => { Thread.Sleep(500 * new Random().Next(1, 10)); Console.WriteLine($"值:{i},当前线程:{Thread.Current 阅读全文
posted @ 2025-07-05 18:59 市丸银 阅读(12) 评论(0) 推荐(0)