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

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

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

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -