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.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.