What is the most efficient way to create a constant (never changes at runtime) mapping of string
s to int
s?
I've tried using a const Dictionary, but that didn't work out.
I could implement a immutable wrapper with appropriate semantics, but that still doesn't seem totally right.
For those who have asked, I'm implementing IDataErrorInfo in a generated class and am looking for a way to make the columnName lookup into my array of descriptors.
I wasn't aware (typo when testing! d'oh!) that switch accepts strings, so that's what I'm gonna use. Thanks!