Starting a new thread in a foreach loop

后端 未结 5 980
你的背包
你的背包 2020-12-05 10:24

I have a List of objects and I\'d like to loop over that list and start a new thread, passing in the current object.

I\'ve written an example of what I thought shoul

5条回答
  •  广开言路
    2020-12-05 11:08

    if sequence is not matter than go for

    Parallel.ForEach(myList, obj => this.MyMethod(obj) );
    

    Write a Simple Parallel.ForEach Loop

提交回复
热议问题