C#


ROSLYN.PERFORMANCE.CA1834 : Consider using 'StringBuilder.Append(char)' when applicable (C#)

See Roslyn-Detected C# Warning Classes for more information.

Summary

'StringBuilder.Append(char)' is more efficient than 'StringBuilder.Append(string)' when the string is a single character. When calling 'Append' with a constant, prefer using a constant char rather than a constant string containing one character.

This check corresponds to Roslyn rule CA1834. For full rule details, see the Microsoft website: CA1834.

Properties

Class Name Consider using 'StringBuilder.Append(char)' when applicable (C#)
Significance reliability
Mnemonic ROSLYN.PERFORMANCE.CA1834
Categories None
Availability Available for C# only.
Enabling Checks for this warning class are enabled by default. To disable them, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += discard class="Consider using 'StringBuilder.Append(char)' when applicable (C#)"

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.