PDA

View Full Version : Resolved Sorting a Collection


jellev
10-11-2009, 12:53 PM
I just need to sort mij BindingList<player> spelersTmp so that the players with number 1 are standing before the players with nr 2.

In this way there are no following players with the same Letter.
(Player p = new Player(a3, a, 3))

Problem is that the BindingList isn't sortable.

I tried something like this:

BindingList<Player> spelersTmp = spelers;
SortedDictionary<Player, int> id = new SortedDictionary<Player, int>();
foreach (Player s in spelersTmp)
id.Add(s, s.nr);
id = id.OrderBy(a => a.Value);


a suggestion?

Solved but to complex to explain, ask me when needed