C# type safe and developer friendly list/collection technique
Posted
by Agile Noob
on Stack Overflow
See other posts from Stack Overflow
or by Agile Noob
Published on 2010-06-16T15:51:37Z
Indexed on
2010/06/16
15:52 UTC
Read the original article
Hit count: 201
c#
|collections
I am populating a "Dictionary" with the results of an sp call. The key is the field name and the value is whatever value the sp returns for the field. This is all well and good but I'd like developers to have a predefined list of keys to access this list, for safety and documentation reasons. What I'd like to do is have something like an enum as a key for the dictionary so developers can safely access the list, but still have the ability to access the dictionary with a string key value.
I am hoping to have a list of string values that I can access with an enum key AND a string key. Please make sure any suggestions are simple to implement, this is not the kind of thing I'm willing to build a lot of overhead to implement.
© Stack Overflow or respective owner