71
1
Imports System
2
Imports System.Linq
3
Imports System.Collections.Generic
4
5
Public Module Module1
6
Public Sub Main()
7
Dim studentList = New List(Of Student) From {
8
New Student() With {.StudentID = 1, .StudentName = "John", .Age = 13},
9
New Student() With {.StudentID = 2, .StudentName = "Moin", .Age = 21},
10
New Student() With {.StudentID = 3, .StudentName = "Bill", .Age = 18},
11
New Student() With {.StudentID = 4, .StudentName = "Ram", .Age = 20},
12
New Student() With {.StudentID = 5, .StudentName = "Ron", .Age = 15}
13
}
14
15
Dim orderByResult = From s In studentList
16
Order By s.StudentName
17
Select s
18
19
Dim orderByDescendingResult = From s In studentList
20
Order By s.StudentName Descending
21
Select s
22
23
Console.WriteLine("Ascending Order")
24
Cached Result
Item that only appeared once is: 8
Number of items in the original collection: 11
Number of items in the dictionary: 6
Number of items in the original collection: 11
Number of items in the dictionary: 6