.net 4.0 位于System.Collections.Concurrent 命名空间下增加了一些同步的集合类

顾名思义就是线程安全的集合类

他包括ConcurrentStack, ConcurrentQueue, and ConcurrentBag等

1.内部使用InterLocked实现同步功能

2.在使用foreach 遍历这些集合的时候(GetEnumerator) ,这些集合内部会创建一个快照返回回来

3.读取Count属性的时候操作会实时返回

4.支持泛型

相关文章:

  • 2022-02-12
  • 2022-12-23
  • 2021-07-18
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-11
  • 2021-10-20
  • 2022-03-05
  • 2022-12-23
  • 2021-11-24
  • 2021-08-13
相关资源
相似解决方案