0

So I have a dictionary which is used to store deserialized JSON data into models in ASP.NET MVC.

Dictionary<string, prosjekt.Models.GamesInfoModel.Datas>

Example of how the models look like:

public class Data
{
public string name {get; set;}
 //etc
}

public class Datas
{
public bool success { get; set; }
public Data data { get; set; }    
}

My problem is accessing the data from the

prosjekt.Models.GamesInfo.Data

which lies under the prosjekt.Models.GamesInfo.Datas in the dictionary.

So how do I access the data from the model/object Data? For example getting it into a variable/list or writing the values to the console.

Botsji
  • 1
  • 3

1 Answers1

0
GamesInfo.Data variable = yourDictionary["YourKey"];

Although you probably want to make sure the key exists first, so it won't throw an execption.

See this other SO question : get dictionary value by key

Syl20
  • 117
  • 2
  • 18