Author: coolblue | Posted on: 7/2/2010 7:57:10 AM | Views : 857

I have been led to believe that the performance benefits of using StringBuilder over normal concatenation means that you should always use stringbuilder when concatenating more than 2 strings.


However when I test them this does not seem to be the case.


Take these 2 methods


public void TestMethod5()
{
for (int i = 0; i < 1000; i++)
{
string t = string.Empty;
t = "dddddddd" + "dddddddd" + "dddddddd" + "dddddddd" + "dddddddd" + "dddddddd" + "dddddddd" + "dddddddd" + "dddddddd" + "dddddddd" + "dddddddd" + "dddddddd" + "dddddddd"; ;
}

}

public void TestMethod6()
{
for (int i = 0; i < 1000; i++)
{
...

Go to the complete details ...