Is it from a sight of resources reasonable to use a StringBuilder already to concat two strings or is there a minimum concatenation operations that makes the StringBuilder efficient?
...the String class is preferable for a concatenation operation if a fixed number of String objects are concatenated
String.Join is the fastest one as it allocates all the required memory in one operation. See this article: StringBuilder vs. String / Fast String Operations with .NET 2.0
Concatenating two strings with StringBuilder won't give you any benefits, since the result still has to be converted to a string - so concatenating them directly is one allocation + two copies. StringBuilder can't do any better - only clutter your code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With