ReSharper
 
Get ReSharper
Get your hands on the new features ahead of the release by joining the Early Access Program for ReSharper 2025.1! Learn more

Code inspection: Use preferred style for discard declaration

Last modified: 11 February 2024

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 _.