Hi Kills,
Just add the below line of code in your code.
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string surname;
int score;
int numRecords = 0;
Console.WriteLine("How many students?");
if (int.TryParse(Console.ReadLine(), out numRecords))
{
List<Student> lstStudent = new List<Student>();
for (var i = 1; i <= numRecords; i++)
{
Student student = new Student();
Console.WriteLine();
Console.Write("Enter Name:");
student.Name = Console.ReadLine();
Console.Write("Enter Surname:");
student.SurName = Console.ReadLine();
Console.Write("Enter Score:");
student.Score = int.Parse(Console.ReadLine());
lstStudent.Add(student);
Console.WriteLine();
}
lstStudent = (List<Student>)lstStudent.OrderBy(x => x.Score).ToList();
for (int i = 0; i < lstStudent.Count; i++)
{
Console.WriteLine("Rank#{0}, Name ={1}, SurName ={2}, Score ={3}", (i + 1).ToString(), lstStudent[i].Name, lstStudent[i].SurName, lstStudent[i].Score.ToString());
}
}
Console.ReadLine();
}
}
public class Student
{
public string Name { get; set; }
public string SurName { get; set; }
public Int32 Score { get; set; }
}
}