[API Proposal]: Add System.Collections.Concurrent.ConcurrentSet<T> #8899
Replies: 1 comment 2 replies
-
You're looking for dotnet/runtime for new API proposals. This repo is for the C# language itself. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Copying this issue but with a change to the type's purpose.
I didn't see any open issues on this repo for it. If there are, sorry in advance.
This is something I was searching for when I needed to create a collection with near O(1) lookup of combined key-values, where the struct itself contains the key and value data, this is very useful in both resource lookups with custom Multi-Key (OR compare logic against select members) types for dictionaries.
This is very useful for in-memory resources lookups from disk-loaded or network-retrieved assets. See below for an example of a sample based on our usage. The implementation is similar to the previous proposal but with the addition of some new functions to justify it's use.
This should already be a thing, because .NET already implements this in the default
HashSet<T>
with my exact justification in the remarks: sourceAPI Proposal:
Proposal for modified continuation of implementation of:
ConcurrentSet<T>
but typeT
should implementIEqualityComparer<T>
. The use cases here is key-value being in the same struct so the default comparer is probably not going to work.Usage Sample
Beta Was this translation helpful? Give feedback.
All reactions