What\'s the most efficient way to concatenate strings?
There are 6 types of string concatenations:
+
) symbol.string.Concat()
.string.Join()
.string.Format()
.string.Append()
.StringBuilder
.In an experiment, it has been proved that string.Concat()
is the best way to approach if the words are less than 1000(approximately) and if the words are more than 1000 then StringBuilder
should be used.
For more information, check this site.
string.Join() vs string.Concat()
The string.Concat method here is equivalent to the string.Join method invocation with an empty separator. Appending an empty string is fast, but not doing so is even faster, so the string.Concat method would be superior here.