I have a situation in code where a Dictionary<string, string>
seemed like the best idea - I need a collection of these objects and I need them to be accessible via a unique key. Exactly what the Dictionary concept is for, right?
Well, the requirements have expanded to the point where I now need to hold an additional bit of information per-key (a boolean value, if you're curious).
So, I figure expand the concept to create a new data structure with the string and the boolean and have it now be a Dictionary<string, NewCustomObject>
.
However, for just one additional value like a boolean flag, it just feels like overkill. And yet I don't know of any Dictionary-like generic object with two values per key.
Is just having a Dictionary of custom objects the best way to go about this or is there something simpler for this scenario?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…