My requirement is to create a datastructure in which I can save boolean values based on a number of keys. for example:
|Mode|Code|Priority|
Name1| | | |
Name2| | | |
Name3| | | |
Name4| | | |
So that whenever I need the boole开发者_StackOverflowan value, I pass Mode, Code, Priority and Name and my datastructure returns the boolean.
Any suggestions?
One option would be to use a Dictionary
whose keys are a custom type encoding the mode, code, priority, and name and whose values are bool
s indicating the value you're storing. If your values are predominantly false
, then you could instead use some sort of hash set that stores tuples associated with true
where all values not present in the set are implicitly missing.
Option 1: Dictionary<Name,MagicalClass>
Option 2: [int][int]
But what you are looking for is clearly the Dictionary and not a matrix.
精彩评论