我正在尝试按类别对一些数据进行排序。每个类别都有一个计数,或类别中的条目数量和我给该类别的分数。分数是最重要的,在排序时应始终首先考虑。计数不如分数重要,但仍然很重要,在排序时应将其视为第二位。
List<string> categories = new List<string>();
List<int> count = new List<int>();
List<int> score = new List<int>();
categories.Add("category1");
count.Add(23);
score.Add(8);
...
for(int i = 0; i < sortedcategories.Count; i++) {
Console.WriteLine(sortedCategories[i] + sortedScore[i] + sortedCount[i]);
}
// Should Output
/*
category8 [Score: 10] [Count: 8]
category2 [Score: 10] [Count: 5]
category1 [Score: 8] [Count: 23]
category5 [Score: 7] [Count: 12]
category4 [Score: 5] [Count: 28]
category3 [Score: 5] [Count: 25]
category7 [Score: 5] [Count: 17]
category6 [Score: 2] [Count: 34]
*/
如何执行排序操作,为我提供上述输出?(如果这更容易与数组,我也可以使用数组)
www说
白衣非少年
有只小跳蛙
随时随地看视频慕课网APP
相关分类