VB.net program to access the generic Tuple list using Statement Lambda

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

'Create Generic Tuple Collection
Dim studentTupleInstances As New List(Of Tuple(Of String, Integer, List(Of String)))()

'Add the first record
studentTupleInstances.Add(New Tuple(Of String, Integer, List(Of String))("Rajlakshmi Biswas", 4, New List(Of String)() From { _
"Mathematics", _
"English", _
"Science and Social Science", _
"Hindi" _
}))

'Add the second record
studentTupleInstances.Add(New Tuple(Of String, Integer, List(Of String))("Niladri Biswas", 36, New List(Of String)() From { _
"Mathematics", _
"English", _
"Computer Science", _
"History", _
"Physics" _
}))

'Add the third record
studentTupleInstances.Add(New Tuple(Of String, Integer, List(Of String))("Arina Biswas", 26, New List(Of String)() From { _
"Mathematics", _
"English", _
"Accountancy", _
"Finance" _
}))


'Access the records using Statement Lambda
studentTupleInstances.ForEach(Function(student) 

Console.WriteLine("Student Name : " + student.Item1)
Console.WriteLine("Student Age : " + student.Item2)

student.Item3.ForEach(Function(subject) Console.WriteLine("Is reading : " + subject))

Console.WriteLine("------------------------------------------")

End Function)

Comments or Responses

Login to post response