How to sort the dictionary by the value field

            // Sort dictionary by the value field
List<KeyValuePair<int, int>> redBallsList = redBallsDict.ToList();
List<KeyValuePair<int, int>> blueBallsList = blueBallsDict.ToList(); redBallsList.Sort((firstPair, nextPair) =>
{
//return nextPair.Value.CompareTo(firstPair.Value);
return - * firstPair.Value.CompareTo(nextPair.Value);
}
); blueBallsList.Sort((firstPair, nextPair) =>
{
//return nextPair.Value.CompareTo(firstPair.Value);
return - * firstPair.Value.CompareTo(nextPair.Value);
}
); // Sort an int Arrary
int[] PerfectBallsIntArr = new int[];
for (int i = ; i < ; i++)
{
PerfectBallsIntArr[i] = Convert.ToInt32(PerfectBallsArr[i]);
} Array.Sort(PerfectBallsIntArr);
上一篇:iOS 内购讲解


下一篇:Django中间件、Auth认证