Concatenation Operators

Sequences (that is, IEnumerable(Of T) objects) expose a method named Concat that enables the creation of a new sequence containing items from two sequences. The following code shows an example in which a new sequence of strings is created from two existing arrays of strings:

Dim firstSequence = {"One", "Two", "Three"}Dim secondSequence = {"Four", "Five", "Six"}Dim concatSequence = firstSequence.Concat(secondSequence)

The result produced by this code is that the concatSequence variable contains the following items: “One”, “Two”, “Three”, “Four”, “Five”, and “Six”. The first items in the new sequence are taken from the one you invoke the Concat method on. You can also use the null-propagating ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.