Refactoring Idea - String+String <-> String.Format <-> StringBuilder

Well I think the subject says it all ;)

Another option I'd consider is to be able to refactor:

string result = "";
foreach (string s in strings)
{
result+=s;
}

to

StringBuilder resultBuilder = "";
foreach (string s in strings)
{
resultBuilder.Append(s);
}
string result = resultBuilder.ToString();

As these are common performance hogs found in code that comes under my nose so to speak.

1 comment
Comment actions Permalink

I've just added:
http://www.intellij.net/tracker/resharper/viewSCR?publicId=9397
http://www.intellij.net/tracker/resharper/viewSCR?publicId=9398
http://www.intellij.net/tracker/resharper/viewSCR?publicId=9399

"Jesse Houwing" <no_mail@jetbrains.com> wrote in message
news:29125787.1124801453719.JavaMail.itn@is.intellij.net...

Well I think the subject says it all ;)

>

Another option I'd consider is to be able to refactor:

>

string result = "";
foreach (string s in strings)
{
result+=s;
}

>

to

>

StringBuilder resultBuilder = "";
foreach (string s in strings)
{
resultBuilder.Append(s);
}
string result = resultBuilder.ToString();

>

As these are common performance hogs found in code that comes under my
nose so to speak.



0

Please sign in to leave a comment.