C#

C#

Made by DeepSource

StringBuilder is initialized with an invalid argument CS-W1050

Bug risk
Critical

StringBuilder constructor has multiple overloads that accept parameters such as string (value) and int (capacity). However, if you initialize it with a char, it gets converted to its int value, thereby invoking the wrong overload of the constructor. It is therefore recommended that you provide a string instead of char.

Bad Practice

var sb = new StringBuilder('a');

Recommended

var sb = new StringBuilder("a");

Reference