On Not "using System.Collections.Concurrent"
来源:互联网 发布:windows10自带看图软件 编辑:程序博客网 时间:2024/04/30 16:25
先看看微软官方文档上的说明吧: "TheSystem.Collections.Concurrent namespace provides several thread-safe collection classes that should be used in place of the corresponding types in the System.Collections and System.Collections.Generic namespaces whenever multiple threads are accessing the collection concurrently."
以ConcurrentDictionary<(Of<(TKey, TValue>)>) 为例又有如下的说明:"ConcurrentDictionary <(Of<(TKey, TValue>)>)is designed for multithreaded scenarios. You do not have to use locks in your code to add or remove items from the collection. However, it is always possible for one thread to retrieve a value, and another thread to immediately update the collection by giving the same key a new value. "。
"Note that ConcurrentDictionary is the one concurrent collection that does not support thread-safe enumeration"。到底还是要有自己写“lock”的时候。
我想微软的初衷,应该是为了方便用户。我不知道在一些对性能要求很高的环境下,System.Collections.Concurrent下的集合其性能与自己写同步其差别有多大,但是在普通情况下,我觉得还是自己写同步比较好,这样比较放心。所以,我还是打算将这个域名束之高阁。
- On Not "using System.Collections.Concurrent"
- using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin
- 为什么要使用using System.Collections.Generic;?
- Synchronized collections vs Concurrent collections
- C#泛型集合 using System.Collections.Generic
- C#泛型集合 using System.Collections.Generic
- C#泛型集合 using System.Collections.Generic
- Concurrent Collections 并发集合
- 根据给出的值、判断是否构成三角形及类型using System; using System.Collections.Generic; using System.Linq; using System.T
- 适用于并行计算的几个集合System.Collections.Concurrent 带锁
- System.Collections
- memory_target not support on this system(oracle11g)
- Could not find libmad on your system
- Could not find liba52 on your system
- memory_target not support on this system
- unavailable function 'system': not available on iOS
- 'system' is unavailable: not available on iOS
- unavailable function 'system': not available on iOS
- awk print使用
- Android学习笔记之Toast
- LoadRunner中文出现乱码的解决办法
- 如何把从串口读到的数据转换为十六进制的字符
- 从网上下载图片
- On Not "using System.Collections.Concurrent"
- 调试错误 ASSERTE(_CrtIsValidHeapPointer(pUserData))
- radio的简单应用
- Linux网络管理之设置IP
- 关于不同编译器下C语言中自加(++)运算符的解释
- 单独开发launcher时碰到的问题
- Linux/Unix操作系统目录结构的来历
- 新浪sae开始支持Python、Java语言,邀请码!
- Win32 关键点总结