This refers to
I will go for a similar example... I have a dictionary containing users
public class UserInfo
{
public string Name { get; set; }
public string Location { get; set; }
}
the data:
private Dictionary<string, UserInfo> users = new Dictionary<string, UserInfo>(); // id + user
and a list of possible locations
private string[] locations = {
"europe",
"america",
"asia",
"africa"
};
how can I order this dictionary by these locations?
There should be the output
// ... all europeans
// ... all americans
// ... all asians
// ... all africans
when calling
Dictionary<string, UserInfo> sortedUsers = ; // Sorting the dict "users" by locations
foreach (KeyValuePair<string, UserInfo> info in sortedUsers)
{
Console.WriteLine("L: " + info.Value.Location + " N: " + info.Value.Name);
}