MSDN User Guide asks us not to use System.Collections and instead of it asks us to use System.Collection.Generic. if it is read only collections than System.Collections.Generic should be used. if the collection is often modified( add/remove) seems like we need to use System.Collections.Concurrent. Question:
MSDN用户指南要求我们不要使用系统。集合,而不是它要求我们使用System.Collection.Generic。如果只读取集合而不读取System.Collections。应该使用泛型。如果集合经常被修改(添加/删除),看起来我们需要使用System.Collections.Concurrent。问题:
Query: "Select * from sometable";
查询:“Select * from sometable”;
Let's say I've retreived all rows from my table ( Query ) and need to pass it into some list which will store sometable object, Which collection type should I use?
假设我从表(查询)中获取了所有行,并需要将其传递到某个将存储sometable对象的列表,我应该使用哪个集合类型?
Seems like if I am targeting .Net 4 than should use System.Collection.Concurrent. Does it mean that System.Collection.Concurrent is superior version of System.Collection.Generic and aimed to replace it?
看起来如果我的目标是。net 4,那么应该使用System.Collection.Concurrent。这是否意味着系统。收集。并发是System.Collection的高级版本。通用的,旨在取代它的?
Thanks a lot
非常感谢
1 个解决方案
#1
1
if I am targeting .Net 4 than should use System.Collection.Concurrent
如果我的目标是。net 4,那么应该使用System.Collection.Concurrent
Only if you want to access the collection from multiple threads.
只有当您希望从多个线程访问集合时。
Does it mean that System.Collection.Concurrent is superior version
这是否意味着系统。收集。并发是高级版本
No, it just contains thread-safe versions.
不,它只是包含线程安全的版本。
#1
1
if I am targeting .Net 4 than should use System.Collection.Concurrent
如果我的目标是。net 4,那么应该使用System.Collection.Concurrent
Only if you want to access the collection from multiple threads.
只有当您希望从多个线程访问集合时。
Does it mean that System.Collection.Concurrent is superior version
这是否意味着系统。收集。并发是高级版本
No, it just contains thread-safe versions.
不,它只是包含线程安全的版本。