Question: I have a SortedDictionary where I am holding points of a particular player and his name next to it. What I need to do is to sort this in a descending order so that I have the winner in the first position of the dictionary. How can I do that?

Also, how can I get an item from the list without knowing the key?

```
SortedDictionary<int, string> dict = new SortedDictionary<int, string>();
dict.Add(player1Pts, playerNames[0]);
dict.Add(player2Pts, playerNames[1]);
dict.Add(player3Pts, playerNames[2]);

```

Thanks for any help!

Answer: 
It doesn't really make sense to use a dictionary with the score as the key: the key must be unique, so it will fail if two players have the same score.

Instead, you should create a `Player` class that contains the name and score, and store `Player` objects in a `List<Player>`. If you need to sort the players by score, you can call `Sort` on the list with a custom comparer, or just order the result with Linq:

```
foreach (Player player in players.OrderByDescending(p => p.Score))
{
    // Do something with player
}

```
For first I think you should switch places of `<int, string>` player name should be key, and points would be values.

Then you can sort it by values:

```
dict.Sort(
    delegate(KeyValuePair<int, double> val1,
    KeyValuePair<int, double> val2)
    {
        return val1.Value.CompareTo(val2.Value);
    }
);

```

You can go through the dictionary by foreach to get keys and values:

```
 foreach (var pair in asd)
            {
                string some = pair.Key;
                int someValue =  pair.Value;
            }

```