Khane
Got something right about marriage
- 20,588
- 14,315
You kind of already answered your own question. Dictionary, List, HashTable, etc. There are a lot of collection types in C#, you just have to call the dictionary.remove method with the index instead of doing a pop. It's not really any different other than passing the actual index rather than built in FIFO or LIFO with stacks and queues.Question: is there a data structure that is sort of like a Queue or Stack but is random access? For example, I request an element at a particular index, that element is retrieved and automatically removed from the set.
I can create such a beast with a custom Dictionary class with some added logic to remove the key after retrieval. But was just curious if there was a formal name for such a beast.