![JAR search and dependency download from the Maven repository](/logo.png)
org.sonar.plugins.csharp.S1643.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonarlint-omnisharp-plugin Show documentation
Show all versions of sonarlint-omnisharp-plugin Show documentation
Code Analyzer based on Omnisharp
Why is this an issue?
StringBuilder
is more efficient than string concatenation, especially when the operator is repeated over and over as in loops.
Noncompliant code example
string str = "";
for (int i = 0; i < arrayOfStrings.Length ; ++i)
{
str = str + arrayOfStrings[i];
}
Compliant solution
StringBuilder bld = new StringBuilder();
for (int i = 0; i < arrayOfStrings.Length; ++i)
{
bld.Append(arrayOfStrings[i]);
}
string str = bld.ToString();
© 2015 - 2025 Weber Informatics LLC | Privacy Policy