Skip to main content

Convert 'foreach' to 'for' and reverse loop

PropertyValue
IdRR0188
Applicable Syntaxforeach statement
Enabled by Default-

Usage

Example #1

before.cs
foreach (object item in items)
{
yield return item;
}
after.cs
for (int i = items.Count - 1; i >= 0; i--)
{
yield return items[i];
}

Configuration

roslynator_refactoring.convert_foreach_to_for_and_reverse_loop.enabled = true|false