WiseTechGlobal / WTG.Analyzers

Analyzers from WiseTech Global to enforce our styles, behaviours, and prevent common mistakes.
Other
15 stars 3 forks source link

New Rules for AsParallel #212

Open jass790909 opened 1 year ago

jass790909 commented 1 year ago

Hi, I would like to suggest a new rule for PLinq that AsParallel should pair up with WithDegreeOfParallelism.

SomeEnumerable
         .AsParallel()
         .WithDegreeOfParallelism(someNumber)
         ...

In our case, we are sending hundreds web requests parallelly, however, we don't want to create so many threads at the same time. As discussion with Brian yesterday, sending request is an IO bound function and therefore we could have this new rule to our project.