Spawn Multiple Threads for work then wait until all finished

后端 未结 12 1551
遇见更好的自我
遇见更好的自我 2020-11-28 01:46

just want some advice on \"best practice\" regarding multi-threading tasks.

as an example, we have a C# application that upon startup reads data from various \"type

12条回答
  •  攒了一身酷
    2020-11-28 02:20

    If you're feeling adventurous you can use C# 4.0 and the Task Parallel Library:

    Parallel.ForEach(jobList, curJob => {
      curJob.Process()
    });
    

提交回复
热议问题