简体   繁体   English

c#先进先出吗? 找不到,不知道在哪里看

[英]c# First in Any out collections? Can't find and Don't know where to look

I know exactly what I am looking for, but not how to ask for it in a search engine. 我确切地知道我在寻找什么,但不知道如何在搜索引擎中提出要求。 I want a collection that can hold any number of objects including duplicates and allows for them to be pulled out randomly. 我想要一个可以容纳任意数量的对象(包括重复对象)的集合,并允许将它们随机取出。 Similar to a deck of cards. 类似于一副纸牌。

I don't know what this kind of collection would be called in c#. 我不知道在C#中将调用哪种类型的集合。 I imagined FIAO(First In Any Out) but that pulls up nothing. 我想象过FIAO(先进先出),但是什么也做不了。 Some direction would be appreciated. 一些方向将不胜感激。

我认为您正在寻找ConcurrentBag-我不确定该数据结构是否存在非并行版本。

A Dictionary does not guarantee any particular order of retrieval, with the Keys collection not being ordered. 字典不保证检索的任何特定顺序,并且Keys集合没有顺序。 You could keep an incrementing count in the value to signify duplicates. 您可以在该值中保留递增计数以表示重复项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM