Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dictionary<int, double> SortowanieSlownika(Dictionary<int, double> slownik)
- {
- Dictionary<int, double> sortowany = slownik;
- List<KeyValuePair<int, double>> tempList = new List<KeyValuePair<int, double>>(sortowany);
- tempList.Sort(delegate (KeyValuePair<int, double> firstPair, KeyValuePair<int, double> secondPair)
- {
- return firstPair.Value.CompareTo(secondPair.Value);
- }
- );
- tempList.Reverse();
- Dictionary<int, double> posortowany = new Dictionary<int, double>();
- foreach (KeyValuePair<int, double> pair in tempList)
- {
- posortowany.Add(pair.Key, pair.Value);
- }
- return posortowany;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement