Write a program in VB.net to print the lexicographically sorted collection

Posted by Rajnilari2015 under VB.NET category on | Points: 40 | Views : 133
Given an collection as "dky", "amit", "sumit", "deepak". The objective is to print the lexicographically sorted collection. The below program will do so

Imports System.Collections.Generic
Imports System.Linq

Namespace ConsoleApplication2
Class Program
Private Shared Sub Main(args As String())
New List(Of String)() From { _
"dky", _
"amit", _
"sumit", _
"deepak" _
}.OrderBy(Function(o) o).ToList().ForEach(Function(i) Console.WriteLine(i))
End Sub

End Class
End Namespace

Comments or Responses

Login to post response