C
C#2y ago
Pacrombie

❔ Trying to figure out a data type

I'm looking for a data type that is sort of like a Dictionary but with "multiple" values. Essentially a table. For example, in the attached table, I want to be able to call something like DataStructure.something(Enter, Xbox) and have it return A. Or DataStructure.something(Edit, PlayStation) and have it return Square. I hope this makes sense. Essentially I'm asking, is there a data structure that already exists in C# that I can leverage or would I have to make this class from scratch or what would be the best course of action?
4 Replies
Pacrombie
Pacrombie2y ago
Currently, I have a switch statement going through Keyboard, PlayStation, and Xbox, and a Dictionary for each of those types holding the input type (Enter, Back, Edit, etc.) as the key and the button on the respective controller as the value. This works but, wow, I really hate it.
Anton
Anton2y ago
map keys to indices, then index with those into a 2d array write a wrapper for that if you want it to be less verbose
rick_o_max
rick_o_max2y ago
Oh, nvm. He wants multiple values, and not multiple keys (duplicated keys, that is why I was going to mention ToLookup)
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts