Wednesday, November 14, 2007

Array.ForEach (also works for )

Thanks to the .Net Tip of the Day for this little gem:

 

    Sub HandleClick()

        Dim myFam As String() = {"Chris", "Sue", "Matthew", "Annie", "Samuel"}

        txtResult.Text = ""

        Array.ForEach(myFam, AddressOf AddSeperator)

    End Sub

 

    Sub AddSeperator(ByVal name As String)

        txtResult.Text += name & "|"

    End Sub

No comments: