//will need these in a second
string a = "5";
string b = "7";
string c = "3";
So because C# will allocate more strings in memory
string mystring = "";
mystring += a;
mystring += b;
mystring += c;
is going to be slower than
StringBuilder sb = new StringBuilder();
sb.Append(a).Append(b).Append(c);
So then, what about:
string mystring = "";
mystring += a + b + c;
Is it just the += part that is slow, or is + also a culprit here?
+= is sintax sugare for s +a.
What about performance, on big numbers of strings StringBuilder is much much more performant.