Even though you can append strings, this is not recommended if you need to do it repetitively, as such operation will have poor performance. The strings are
immutable. When you append strings, a brand-new instance is always created. Do I even need to explain the implication of this on performance?
So, if you have several concatenation of small fixed number of strings, use
string.Format
. If you scheme of composing a string is more complex, such with loops or other constructs (ifs, and so on), use the mutable type
System.Text.StringBuilder
:
http://msdn.microsoft.com/en-us/library/system.text.stringbuilder.aspx[
^].
—SA