c# - Can't add value into Dictionary containing dictionaries of dictionaries -


i have dictionary:

public dictionary<string,dictionary<string, dictionary<datetime, float>>> cpuresults = new dictionary<string,dictionary<string, dictionary<datetime, float>>>(); 

now, i'd add data:

cpuresults.add("key 1", new dictionary<string, dictionary <datetime, float>>().add("key 1", new dictionary<datetime,float>())); 

actually, don't want keys be: key 1, key 2, etc. - not complicate named keys this.

well, important thing is, won't compile. have no idea did wrong - took me while come this, still doesn't work.

the dictionary<tkey, tvalue>.add method doesn't return dictionary. instead, initialize inner dictionary this:

cpuresults.add(     "key 1",     new dictionary<string, dictionary <datetime, float>>     {         { "key 1", new dictionary<datetime,float>() }      }); 

Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -