Skip to main content

Convert 'while' statement to 'do' statement

PropertyValue
IdRR0150
Applicable Syntaxwhile statement
Syntax Spanwhile keyword
Enabled by Default✓

Usage​

Example #1​

before.cs
while (condition)
{
}
after.cs
if (condition)
{
do
{
} while (condition);
}

Configuration​

roslynator_refactoring.convert_while_to_do.enabled = true|false