Preferences configurable on this page are taken into account when ReSharper produces new code with code completion and code generation features, applies code templates and performs refactorings. They can also be applied to the existing code by using code cleanup with the corresponding settings.
The preferences with the Notify with selector have corresponding code inspections that notify you if this aspect of the code style in the inspected scope differs from the preferred style. Using the selectors, you can configure severity levels of the inspections.
|Apply code style on completion|
Use this checkbox to apply configured syntax styles when you accept code completion suggestions.
|'var' usage in declarations|| Preferences in this section define how the implicitly typed local variables (also known as |
|Prefer separate declarations for deconstructed variables|
By default, ReSharper will suggest joined notation for multiple
|Use 'var' keyword for discards|
By default, ReSharper suggests using standalone
|Instance members qualification|
Preferences in this section define how to use 'this' qualifier. For more information, see Code Syntax Style: Optional Member Qualifiers.
|Static members qualification|
Preferences in this section define how to qualify static members. For more information, see Code Syntax Style: Optional Member Qualifiers.
|Built-in type naming|
|Reference qualification and 'using' directives|| |
Preferences in this section define the style of namespace imports:
A number of other options related to namespace imports can be configured on thepage of ReSharper options.
Preferences in this section define how to arrange modifiers of types and members. For more information, see Code Syntax Style: Modifiers.
Preferences in this section let you define how named or positional arguments should be enforced for specific types of parameters. For more information, see Code Syntax Style: Named/Positional Arguments.
Preferences in this section let you define when optional parentheses should be removed or added if they help you clarify precedence of operations. For more information, see Code Syntax Style: Optional Parentheses.
Preferences in this section let you define which statements require braces for single nested statements. For more information, see Code Syntax Style: Braces for Single Nested Statements.
Preferences in this section let you define which kinds of members should be declared with the expression body and which with the block body. For more information, see Code Syntax Style: Bodies of Function Members.
Preference in this section defines how to arrange multiple attributes. For more information, see Code Syntax Style: Multiple Attributes.
If there are .editorconfig files that affect your solution, preferences on this page could be overridden by EditorConfig styles. You will see a yellow warning if at least one preference on the page is overridden by EditorConfig styles for the current file, each overridden preference will also be highlighted with yellow. For example:
Changing code styles from the editor
You can also change specific code style preferences right in the editor, by pressing Alt+Enter where style violations are highlighted. For example, you can change the preference of 'var' usage in declarations for simple types:
... as well as the severity level of the corresponding inspection:
Note that when you change preferences from the editor, your changes are saved using the smart save logic.
- Naming Style
- Managing and Applying Code Formatting Rules
- File and Type Layout
- File Header Style
- Code Syntax Style: Namespace Imports
- Code Syntax Style: Implicit/Explicit Typing ('var' Keyword)
- Using Auto-Properties
- Making Fields Readonly
- Code Syntax Style: Multiple Attributes
- Code Syntax Style: Modifiers
- Code Syntax Style: Optional Member Qualifiers
- Reformatting XML Doc Comments
- Removing Code Redundancies