I need to maintain a mapping between enum values, and a multi-value type (name+number). e.g.
- ABC : {"john", 123}
- DEF : {"paul", 234}
- GHI : {"ringo", 345}
I planned to do this using a Dictionary
of some type but strictly speaking not only the keys should be unique, but the values too - it's like a bi-directional dictionary.
Then I need to be able to write a method MyEnum lookup(string name, int number)
which I'd planned would call .Single(x => x.Value.name == name && x.Value.number == number)
But I'm struggling to find the right types and apparently the KeyValuePair
returned cannot be null which is a problem if there is no match.
What is a good way to approach this?