ReSharper 2024.2 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 desired naming styles for symbols in your code. There is 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 capitalization of compound words, underscores, suffixes, prefixes, 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 rules

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 more information about editing naming rules, refer to modifying default naming rules.

Support Microsoft events naming style

By default, ReSharper suggests $object$On$event$ naming pattern for event subscriptions on fields and On$event$ for event subscriptions on this, which is used both when ReSharper generates new events, and when it checks the naming style of the existing events. You can change these patterns 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, make sure that this checkbox is selected. This will suppress 'Inconsistent Naming' warnings on these events.

Abbreviations

Add uppercase abbreviations that ReSharper should not report as inconsistent naming when they are used in symbol names. Use newlines spaces as delimiters.

Last modified: 27 February 2024