Search code examples
c#editorconfig

EditorConfig - simplify boolean evaluations?


Is there an EditorConfig setting for simplifying boolean evaluations in if statements? e.g.

// prefer:
if (thingy)

// over:
if (thingy == true)

and

// prefer:
if (!thingy)

// over:
if (thingy == false)

Solution

  • You can configure the corresponding analyzer with this in your .editorconfig:

    dotnet_diagnostic.IDE0100.severity = warning
    

    See https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0100