I have a variable that stores a dictionary returned by a method, that is, the variable calls a method and it returns a dictionary.
var listofchamps = SAPI.GetChampions(RiotSharp.Misc.Region.euw, data).Champions.Values;
I attach the following image:
I could iterate all the integers returned with a foreach such that:
foreach (var something in listofchamps)
{
if(something.Id == champ_id) { Console.WriteLine(something.Name); break; }
}
However, I think it is not very efficient, because you need to load the key one by one, making a comparison between the id of the list and the current id by the user.
I was wondering how I could get the string directly, giving it the value such as:
listofchamps[champ_id];
in this way access the string without calling the foreach.
Thanks in advance.