.net 4.0 同步集合类 System.Collections.Concurrent

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

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

他包括ConcurrentStack, ConcurrentQueue, and ConcurrentBag等

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

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

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

4.支持泛型

posted on 2010-12-02 17:27  听说读写  阅读(592)  评论(0编辑  收藏  举报

导航