S100 — Methods and properties should be named in PascalCase

Language
C#
Type
Code smell
Severity
Minor
Tags
convention

Why is this an issue?

Shared naming conventions allow teams to collaborate efficiently.

This rule raises an issue when a method or a property name is not PascalCased.

For example, the method


public int doSomething() {...} // Noncompliant

should be renamed to


public int DoSomething() {...}

Exceptions


void My_method_(){...} // Noncompliant, leading and trailing underscores are reported

void My_method(){...} // Compliant by exception

Allowing custom acronyms

You can configure the rule to ignore certain acronyms by adding a Microsoft Code Analysis Dictionary as an AdditionalFiles item in your project:


<Dictionary>
    <Acronyms>
        <CasingExceptions>
            <Acronym>SEO</Acronym>
            <Acronym>IAC</Acronym>
        </CasingExceptions>
    </Acronyms>
</Dictionary>

<ItemGroup>
    <AdditionalFiles Include="CustomDictionary.xml" />
</ItemGroup>

Resources

Documentation

↑ Back to top