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: Redundant 'case' label

Last modified: 08 April 2024

Empty case sections before the default case in a switch statement do not make any sense because code corresponding to their conditions will be executed in the default case anyway. ReSharper suggests removing such empty case sections:

Note that empty case sections before a non-empty case section are valid and mean that the code in the non-empty case section executes for all cases that go before it.