36
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
5
namespace ConsoleApplication1
6
{
7
internal class Student
8
{
9
public int Id { get; set; }
10
public string Name { get; set; }
11
public int Rank { get; set; }
12
public int Age { get; set; }
13
}
14
15
public class Program
16
{
17
public static void Main(string[] args)
18
{
19
List<Student> students = new List<Student>();
20
students.Add(new Student { Id = 1, Name = "Ramesh", Rank = 1, Age = 39 });
21
students.Add(new Student { Id = 2, Name = "Kapil", Rank = 1, Age = 32 });
22
students.Add(new Student { Id = 3, Name = "Suresh", Rank = 2, Age = 45 });
23
students.Add(new Student { Id = 4, Name = "Mahesh", Rank = 2, Age = 39 });
24
25
var studentsOrderByRank = from student in students
26
orderby student.Rank, student.Age
27
select student;
28
29
Console.WriteLine("Sorted Students:");
30
foreach (var student in studentsOrderByRank)
31
{
32
Console.WriteLine(student.Name);
33
}
34
}
35
}
36
}
Cached Result
Compilation error (line 8, col 1): The type or namespace name 'List<>' could not be found (are you missing a using directive or an assembly reference?)
Compilation error (line 8, col 23): The type or namespace name 'List<>' could not be found (are you missing a using directive or an assembly reference?)
Compilation error (line 13, col 1): The type or namespace name 'List<>' could not be found (are you missing a using directive or an assembly reference?)
Compilation error (line 13, col 20): The type or namespace name 'List<>' could not be found (are you missing a using directive or an assembly reference?)
Compilation error (line 8, col 23): The type or namespace name 'List<>' could not be found (are you missing a using directive or an assembly reference?)
Compilation error (line 13, col 1): The type or namespace name 'List<>' could not be found (are you missing a using directive or an assembly reference?)
Compilation error (line 13, col 20): The type or namespace name 'List<>' could not be found (are you missing a using directive or an assembly reference?)