JetBrains Rider 2026.3 Help

Code inspection: Convert 'goto' statement to labeled 'break' or 'continue'

This inspection reports a goto statement that only exits a loop or a switch statement, or that only moves to the next loop iteration. Starting with C# 15, you can use break or continue instead.

Example

foreach (var item in items) { if (item == 0) goto done; } done: return;
foreach (var item in items) { if (item == 0) break; } return;

Quick-fix

Replace the goto statement with break or continue. If the target is an outer loop, the quick-fix adds a label to that loop and uses break label; or continue label;.

27 October 2026