ReSharper 2024.1 Help

Code Inspection: Use preferred style for discard declaration

Category

Syntax Style

ID

SuggestDiscardDeclarationVarStyle

EditorConfig

resharper_suggest_discard_declaration_var_style_highlighting

Default severity

Hint

Language

C#

Requires SWA

No

This inspection checks the code style for using 'var' in declarations.

By default, ReSharper suggests using standalone _ for discards, for example (_, _) = (0, 1);. You can select Use 'var' keyword for discards on the Code Editing | C# | Syntax Style page of ReSharper options to always use var with discards where appropriate thus making sure that there are no conflicts with variables in the scope that may be named _.

Last modified: 15 April 2024