-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Open
dotnet/sdk
#51215Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Runtimecode-analyzerMarks an issue that suggests a Roslyn analyzerMarks an issue that suggests a Roslyn analyzerin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
Description
Background and motivation
In microsoft/testfx, we have had an occurrence of this pattern (see microsoft/testfx#6013).
This pattern can be replaced by stringBuilder.Append(c, repeatCount)
to avoid the allocation of an intermediate string.
API Proposal
A CAxxx rule shipped in .NET SDK (Category=Performance) that suggests the simplified, and more performant overload of StringBuilder.Append
API Usage
Warning on:
builder.Append(new string(c, repeatCount))
A codefix is provided to change the above to:
builder.Append(c, repeatCount)
Alternative Designs
No response
Risks
No response
Lancelotbronner and lindexiCopilot
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Runtimecode-analyzerMarks an issue that suggests a Roslyn analyzerMarks an issue that suggests a Roslyn analyzerin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged