我有一个数组列表。每个数组由一个分数和一个难度组成。从文本文件中读取。
这就是我获取数据并按分数降序排列的方式。
// load highscores
public void LoadScores()
{
// loop through each line in the file
while ((line = file.ReadLine()) != null)
{
// seperate the score from the difficulty
lineData = line.Split(',');
// add each line to the list
list.Add(lineData);
}
// order the list by descending order
IOrderedEnumerable<String[]> scoresDesc = list.OrderByDescending(ld => lineData[0]);
}
是否可以将 a 子句添加到 theIOrderedEnumerable
中,以便在难度所在的位置按分数降序排列1
?