VB.net program to find out Even/Odd numbers using OUT parameters

Posted by Rajnilari2015 under VB.NET category on | Points: 40 | Views : 99
The below program will do so

Class MainClass
Public Shared Sub Main(args As String())
Dim evenNumList = New List(Of Integer)()
Dim oddNumList = New List(Of Integer)()

GetEvenOddNumbersUsingOutParameters(evenNumList, oddNumList)

End Sub

Private Shared Sub GetEvenOddNumbersUsingOutParameters(ByRef evenNumList As List(Of Integer), ByRef oddNumList As List(Of Integer))
Dim numbers = Enumerable.Range(1, 20)
'generate numbers between 1 to 20
evenNumList = numbers.Where(Function(i) i Mod 2 = 0).ToList()
oddNumList = numbers.Where(Function(i) i Mod 2 <> 0).ToList()
End Sub

End Class

Comments or Responses

Login to post response