Dynamic Dictionaries with C# 4.0

Have you ever been working with the Dictionary<TKey, TValue> object in .NET and just wanted to find some way in which you can do this:
var dictionary = new Dictionary<string, string> { { "hello", "world!" } }; … var so…

Have you ever been working with the Dictionary<TKey, TValue> object in .NET and just wanted to find some way in which you can do this: var dictionary = new Dictionary<string, string> { { "hello", "world!" } }; ... var something = dictionary.hello; It’d be sweet, but it’s not possible. The dictionary is just a bucket and there isn’t a way it can know at compile type about the objects which are within it.
Print Share Comment Cite Upload Translate
CITATION GOES HERE CITATION GOES HERE
Select a language: