What is the correct usage of ConcurrentBag?

前端 未结 3 1303
一生所求
一生所求 2021-02-03 17:10

I\'ve already read previous questions here about ConcurrentBag but did not find an actual sample of implementation in multi-threading.

Concur

3条回答
  •  日久生厌
    2021-02-03 17:41

    If List is used with a lock around Add() method it will make threads wait and will reduce the performance gain of using Parallel.ForEach()

提交回复
热议问题