将Collection添加到BlockingCollection(add Collection to BlockingCollection)
BlockingCollection仅包含添加单个项目的方法。 如果我想添加一个集合怎么办? 我应该只使用“foreach”循环吗?
为什么BlockingCollection不包含添加集合的方法? 我认为这种方法非常有用。
BlockingCollection contains only methods to add individual items. What if I want to add a collection? Should I just use "foreach" loop?
Why BlockingCollection doesn't contain method to add a collection? I think such method can be pretty useful.
最满意答案
ICollection接口和许多BCL列表类型由于某种原因没有AddRange方法,这很烦人。
是的,您需要foreach知道该集合,如果您经常使用它,您可以编写自己的扩展方法。
ICollection interfaces and many of the BCL list-type classes don't have an AddRange method for some reason and it is annoying.
Yes, you'll need to foreach over the collection, you could write you own extension method if you're using it a lot.
更多推荐
发布评论