ReSharper 2021.3 Help

Naming Style

ReSharper options: Code Editing | C# | Naming Style

This page of ReSharper options defines symbol naming rules for C#.

ReSharper helps you define, control, and apply naming style for symbols in your code. Naming style is implemented as a set of rules, each of which targets specific identifiers with the set of constraints . Each rule can have one or more associated styles that define suffixes, prefixes, capitalization of compound words, and so on.

These rules are taken into account when ReSharper produces new code with code completion and code generation features, applies code templates and performs refactorings. ReSharper also helps you detect and fix violations of naming rules. If necessary, the automatic checkup of naming rules can be configured or disabled.

Enable 'Inconsistent Naming' inspection

This checkbox toggles the Inconsistent Naming inspection in C#, VB.NET, JavaScript, TypeScript and XAML.

Use auto-detected values

If this checkbox is selected, ReSharper will do the following:

  1. Detect naming rules based on the symbol naming in the newly opened solutions.

  2. Change preferences for the rules where detected style differs from your current settings.

  3. Save the modified naming rules to the 'Solution personal' settings layer so that these settings only affect the current solution.

  4. Highlight the automatically-set naming rules with yellow:

    ReSharper highlighting automatically-set naming rules with yellow

Edit

Click this button, or double-click a list entry, to edit the selected naming rule using the Edit Rule Settings dialog. For details on editing naming rules, see modifying default naming rules.

Advanced settings

Opens the Advanced Naming Settings, where you can configure the following settings:

Custom naming rules

Allows configuring custom naming rules.

Event handlers naming style

By default, ReSharper suggests $object$On$event$ pattern for events, which is used both when ReSharper generates new events, and when it checks the naming style of the existing events. You can change this pattern if necessary.

When new events are generated by Visual Studio, it uses another naming pattern: $object$_$event$. If you have an existing project where events are named this way and you do not want to rename them, you can select the Support Visual Studio naming style checkbox to suppress 'Inconsistent Naming' warnings on these events.

Abbreviations

Add uppercase abbreviations that ReSharper should not warn you about when they are used in symbol names. Use newlines, commas, semicolons, or spaces as delimiters.

Last modified: 07 April 2022