I read some articles about stringBuilder vs string.
I'm using the loop, so I must use string builder.
My example:
String s1;
String s2;
String s3;
StringBuilder webLines=new StringBuilder(10000);
for (int i = 0; i < 10000; i++)
{
s1="get from logic 1"
s2="get from logic 2"
s3="get from logic 3"
webLines.Append("<tr><tD nowrap>");
webLines.Append(s1);
webLines.Append("</td><td nowrap>");
webLines.Append(formatR(s2, 2));
webLines.Append("</tD><td nowrap>");
webLines.Append(s3);
webLines.Append("</td></tr>");
//this is better performance than using:
//webLine.Append("<tr><tD nowrap>" + s1 + "</td><td nowrap>" +
//formatR(s2,2) + "</tD><td nowrap>" + s3 + "</td></tr>");
}
If I use append for each word (my real example has much more words than this
one)
than I must write a lot of lines of code.
Could I somehowe append all words in one line with the same performance?
Something like:
webLines.Append(String.Concat("<tr><tD nowrap>" + s1 + "</td><td nowrap>" +
formatR(s2,2) + "</tD><td nowrap>" + s3 + "</td></tr>"));
What do you think?
Regards,Simon