I need to concatenate a lot of strings alltogether and put a comma between any of them. I have a list of strings
\"123123123213\"
\"1232113213213\"
\"1232131
You should use string.Join()
because:
a) it's much more readable, maintainable and easy on the eyes.
b) it uses a StringBuilder
internally already, so it's very efficient ( you can confirm yourself using Reflector).
Edit:
string.Join()
uses a StringBuilder
for the general case of an IEnumerable
input. If you already have an array on the other hand it uses some voodoo magic (including FastAllocateString()
and UnSafeCharBuffer
) to be even faster.