I have a list of arrays. Each array consists of a score and a difficulty. Read in from a text file.
This is how I get the data and order it by the score in descending order.
// 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]);
}
Is it possible to add the a clause to the IOrderedEnumerable
so that it orders by the score in descending order where the difficulty is 1
?