OK, there is just something like this:
Dictionary<string, dynamic>
object
And I have a Dictionary<string, string>
object like this :
{"great":"well","well":"WTF?",...}
But Dictionary<string, dynamic> dyndict = new Dictionary<string, string>()
is actually not available.
Is there some good way to assign the latter dict to the dynamic one?
Maybe I'll use a while loop? But what if have some variant Dictionary<string, int>
orDictionary<string, MyObject>
or so on? Is there some method like extend
in C#?
How can I be more elegant? (And that's why I choose C#! :) )
UPDATE1
What I want to figure out is a generic way to extend my dynamic-value dictionary. Can Extension Methods help me out? Or am I wrong at the start point?
UPDATE2
To be more specific, what I what is to achieve an auto duck-type dict......The ToDictionary()
is also typed dict, I want to know wether there is a way like this:
Dictionary<string, dynamic> dyndict = new Dictionary<string, dynamic>()
Dictionary<string, string> otherDict = new Dictionary<string, string>(){...}
dyndict.extend(otherDict )
ToDictionary(),right....Thanks!