user610961
user610961

Reputation: 181

Confusion in choosing which collection to use

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:

Query: "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?

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?

Thanks a lot

Upvotes: 0

Views: 182

Answers (1)

Henk Holterman
Henk Holterman

Reputation: 273219

if I am targeting .Net 4 than should use 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.

Upvotes: 1

Related Questions