Mega Code Archive

 
Categories / VB.Net / Data Structure
 

Use Action(Of (T)) delegate to print the contents of a List(Of (T)) object

Imports System Imports System.Collections.Generic Class Program     Shared Sub Main()         Dim names As New List(Of String)         names.Add("A")         names.Add("B")         names.Add("C")         names.Add("D")         names.ForEach(AddressOf Print)     End Sub     Shared Sub Print(ByVal s As String)         Console.WriteLine(s)     End Sub End Class