为什么没有一个ConcurrentList< T> [英] Why isn't there a ConcurrentList<T>

查看:1152
本文介绍了为什么没有一个ConcurrentList< T>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新的命名空间System.Collections.Concurrent包含并发集合了字典,队列和其他类中叠加。任何人都知道为什么它没有ConcurrentList?

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?

我已经发布了一个新问题,说明我目前的情况。我preferred,要改变原来问题的整体感。这里的<一个href="http://stackoverflow.com/questions/7895766/what-thread-safe-collection-is-appropriate-for-this-scenario">the 链接到新的问题。

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.

推荐答案

随机访问不会做出这与另一个线程改变的数据结构太大的意义。

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

如果你看一下并发集合,你会发现,它们的接口是专为多线程访问工作。我想不出一个有用的列表式界面与多线程code行之有效的。

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.

这篇关于为什么没有一个ConcurrentList&LT; T&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆