Parallel并发执行多个任务 多线程的,主线程会参与计算---阻塞界面等于TaskWaitAll+主线程计算

常用方法

1、Invoke  尽可能并行执行提供的每个操作

 1             Console.WriteLine("***************Parallel.Invoke Start******************");
 2             Parallel.Invoke(
 3                 () => Console.WriteLine("action0"),
 4                 () => Console.WriteLine("action1"),
 5                 () => Console.WriteLine("action2"),
 6                 () => Console.WriteLine("action3"),
 7                 () => Console.WriteLine("action4"),
 8                 () => Console.WriteLine("action5"),
 9                 () => Console.WriteLine("action6"));
10             Console.WriteLine("***************Parallel.Invoke End******************");
11             Console.WriteLine();
View Code

相关文章:

  • 2021-07-09
  • 2022-12-23
  • 2021-05-22
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-10
  • 2021-11-10
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2021-11-05
  • 2021-07-06
相关资源
相似解决方案