0
I am trying to make a Sort of a list that has information from a text file, to fetch the information from the file I use:
string ficheiro = "tvInfo.txt";
List<string> Classificacoes;
var linha = File.ReadAllLines(ficheiro);
Classificacoes = new List<string>();
foreach (var linhas in linha)
{
Classificacoes.Add(linhas);
}
After fetching the information the list looks like this:
Liverpool;50
Arsenal;10
Benfica;20
PSG;30
I wanted to do the list Sort from the second field. I’m trying to use Linq but I can’t get past here:
Classificacoes.OrderByDescending(c => c);
It’s pretty simple, you made some code?
– novic
The code I have is just to fill the list with the information from the string file string file = "tvInfo.txt"; List<string> Classifications; var line = File.Readalllines(file); Classifications = new List<string>(); foreach (var lines in line) { Classifications.Add(lines); }
– user172927
So this list just use Linq with the Orderby method that solves
– novic
That’s what I’ve been trying to do Classificacoes.Orderbydescending(c=>c), but the problem is that I can’t complete the code
– user172927
You need to put this in your question and better organize your code that text still needs to be broken in two parts each row
– novic