.netthread-safetytask-parallel-libraryconcurrent-collections

Why isn't there a ConcurrentList<T>


The new namespace System.Collections.Concurrent contains concurrent collections for dictionary, queue and stack among other classes. Anyone know why is it that there is no ConcurrentList?

UPDATE

I've posted a new question explaining my current scenario. I preferred that to changing the whole sense of the original question. Here's the link to the new question.


Solution

  • Random access doesn't make much sense on a data structure that's changed from another thread.

    If you look at the concurrent collections, you'll notice that their interface is specifically designed to work well with multi threaded access. I can't think of a useful list-like interface that works well with multithreaded code.

    Random multi threaded access can make sense if the elements are never moved, but then you have an array.