c# - Using a multilayered dictionary -


sorry if i'm not using right terminology in question i'm hoping clear up.

basically have following data structure:

match_id top key
players , winning_team contained keys within
list of players , boolean value values of players , winning_team.

{"match_id":[{"players": [list], "winning_team": true}]} 

right i'm storing using 2 dictionaries, under structure:

dictionary<string, dictionary<string, dynamic>> 

however requires 2 dictionaries, , have lot of matches evaluate iteratively. want know if can store dictionary format without creating new dictionary.

yes, create class:

public myclass  {    public list<string> players{get;set;}    public bool winningteam {get;set;} } 

and initialize dictionary this:

var mydictionary = new dictionary<string, myclass>(); 

and can add like:

mydictionary.add("match_id", new myclass() {     players: new list<string>(),     winningteam:true } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -