Is there a concurrent ordered collection?
And if there isn't, how would you find a workaround for a bunch of threads generating some data and adding it to a collection where it can be accessed by index?
4 Replies
Or could I use a concurrent dictionary.
And use keys instead of indecies.
ConcurrentBag is a thing https://learn.microsoft.com/en-us/dotnet/api/system.collections.concurrent.concurrentbag-1?view=net-7.0
but i guess that doesn't satisfy the index thing really
Your original question asked about an "ordered" collection, but collections accessed by index (like lists / arrays) or by key (dictionaries) are not generally considered ordered.
What are your actual requirements?
Ok it doesn't mean what I thought it meant
Also I realized how stupid my initial question was