I have a method that takes a List<int>
, which is a list of IDs. The source of my data is a Dictionary<int, string>
where the integers are what I want a list of. Is there a better way to get this than the following code?
var list = new List<int>();
foreach (var kvp in myDictionary)
{
list.Add(pair.Key);
}
ExecuteMyMethod(list);