WiseTechGlobal / WTG.Analyzers

Analyzers from WiseTech Global to enforce our styles, behaviours, and prevent common mistakes.
Other
16 stars 3 forks source link

Extend WTG3011 to cover some string constructors. #169

Closed brian-reichle closed 2 years ago

brian-reichle commented 2 years ago

Extend WTG3011 to cover the following cases:

builder.Append(new string(c, repeat)); // string(char, int)
builder.Append(new string(buffer)); // string(char[])
builder.Append(new string(buffer, start, length)); // string(char[], int, int)

The code fixes should rewrite them to:

builder.Append(c, repeat); // string(char, int)
builder.Append(buffer); // string(char[])
builder.Append(buffer, start, length); // string(char[], int, int)