gpt4 book ai didi

c# - BlockingCollection.GetConsumingEnumerable() 是否删除项目

转载 作者:太空狗 更新时间:2023-10-30 01:08:52 30 4
gpt4 key购买 nike

有人可以确认下面的代码确实从 BlockingCollection 中删除了项目

foreach (var item in myCollection.GetConsumingEnumerable())
{
//Do stuff
}

它确实在 MSDN 上说它确实如此,但我只需要再次保证,因为我有一个近乎实时的应用程序接受输入到这些集合中的 4 个相隔 60 毫秒,一段时间后我的应用程序卡住了,我不知道为什么,只是想确保这些项目正在被删除。

最佳答案

documentation说:

Return value:
An IEnumerable that removes and returns items from the collection.

(强调)

关于c# - BlockingCollection.GetConsumingEnumerable() 是否删除项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8228697/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com