Concatenation Operators

As in the previous versions, Visual Basic 2010 still offers concatenation operators that are the + and & symbols. The main difference is that the + symbol is intended for numeric additions, although it can works also with strings; the & symbol is instead defined only for strings, and it should be preferred when concatenating strings so that you can avoid possible errors. Listing 4.2 shows an example of concatenation.

Listing 4.2 Concatenation Operators

image

Get Visual Basic® 2010 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.