Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (22 sloc) 568 Bytes

MA0028 - Optimize StringBuilder usage

new StringBuilder().Append($"a{10}");
new StringBuilder().Append("a" + 10);

// Should be
new StringBuilder().Append("a").Append(10);
new StringBuilder().Append("a");

// Should be
new StringBuilder().Append('a');
new StringBuilder().Append(10.ToString());

// Should be
new StringBuilder().Append(10);
new StringBuilder().Append(10.ToString("n1", CultureInfo.CurrentCulture));

// Should be
new StringBuilder().AppendFormat(CultureInfo.CurrentCulture, "{0:n1}", 10);
You can’t perform that action at this time.