ReSharper 2024.1 Help

Code inspection: Use discard assignment

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.

void Sample(object someValue) { var unused = someValue; }
void Sample(object someValue) { _ = someValue; }
Last modified: 15 May 2024