Code inspection: Char is possibly unintentionally used as integer
Some types have constructor overloads where a char argument is accepted as a number, even though an overload taking a string also exists. In those cases, a single character can easily be passed by mistake and interpreted as a numeric capacity or count.
This inspection reports constructor calls where a char argument is used for an integer-like parameter while another available overload would accept a string in the same position.
Example
using System.Text;
class Example
{
void Test()
{
var builder = new StringBuilder('a');
}
}
using System.Text;
class Example
{
void Test()
{
var builder = new StringBuilder("a");
}
}
01 April 2026