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 discard assignment

Last modified: 15 May 2024

This inspection suggests using the discard syntax _ for intentionally unused variables.

It employs various heuristics to detect code patterns that existed before the introduction of discard assignment to deal with intentionally unused variables. A quick-fix is offered to rewrite the code more idiomatically using discards.