Diana,
In addition to readability as Herfried suggests, the & operator will
concatenate any constants at compile time. String.Concat is strictly a
runtime function.
Const format As String = "Hello" & ControlChars.NewLine & "World"
When dealing with Object variables (parameters really) & Option Strict On
String.Concat is useful:
Option Strict On
Dim i1 As Object = 1
Dim f1 As Object = 1.0F
Dim d1 As Object = 100D
Dim s1 As Object = "help"
Debug.WriteLine(i1 & f1 & d1 & s1)
Debug.WriteLine(String.Concat(i1, f1, d1, s1))
The first statement is a compile error, while the second succeeds, both
should return the same result! As String.Concat is overloaded for both
String & Object!
Hope this helps
Jay
"Diana Mueller" <diana@nospam> wrote in message
news:un**************@TK2MSFTNGP14.phx.gbl...
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb im
Newsbeitrag
news:OS**************@TK2MSFTNGP14.phx.gbl... I suggest to use the '&' operator for string concatenation instead of
using 'String.Concat'.
Why is that preferable?