Здравствуйте.
Вот так вывожу данные из текста в dataGridView.
public Uefa(int number, string fio, string club, string role, int games, int goal, int assist)
{
this.number = number;
this.fio = fio;
this.club = club;
this.role = role;
this.games = games;
this.goal = goal;
this.assist = assist;
}
public static List<Uefa> getList()
{
// структура
List<Uefa> list = new List<Uefa>();
// массив данных
string[] arr = System.IO.File.ReadAllLines(filename, Encoding.Default);
for (int i = 0; i < arr.Length; i++)
{
// разбивка на подстроки
string[] line = arr[i].Split(' ');
Uefa data = new Uefa(list.Count + 1, line[0], line[1], line[2], Convert.ToInt32(line[3]), Convert.ToInt32(line[4]), Convert.ToInt32(line[5]));
// заполняем структуру
list.Add(data);
}
return list;
}
}
Number в файле. Это порядковый номер записи.
Вот так делаю сортировку.
dataGridView1.DataSource = null;
list = list.OrderBy(x => x.club).ToList<Uefa>();
Данные сортируются, но при этом сортируются и порядковый номер. Т.е. выходит 3,4,1,5.
Как зафиксировать порядковый номер, чтобы он не сортировался?
Заранее спасибо.