The Conversion operator of LINQ is a
operator which is used Four ways simple ToArray , ToList , ToDictionary
and OfType. In this article first we discuss about First two categories.
EXAMPLE CODE
Module Module1
Sub Main()
Dim Numbers() = {7.8, 4.6, 9.0, 1.1, 10.7}
Dim SortedList = From c In Numbers Select c Order By c Descending
Dim Arrays = SortedList.ToArray()
Console.WriteLine("All Numbers from highest to lowest:")
For c As Integer = 0 To Arrays.Length
Console.WriteLine(Arrays(c))
c += 1
Next
Console.ReadLine()
End Sub
End Module
OUTPUT
EXAMPLE CODE
Module Module1
Sub Main()
Dim Names() = {"ajay", "rahul", "manish", "ravi", "raj"}
Dim sortedList = From a In Names Select a Order By a
Dim List = sortedList.ToList()
Console.WriteLine("The sorted list:")
For Each a In List
Console.WriteLine(a)
Next
Console.ReadLine()
End Sub
End Module
OUTPUT
Read More articles related LINQ Click Here