Convert 'foreach' to 'for' and reverse loop
Property | Value |
---|---|
Id | RR0188 |
Applicable Syntax | foreach 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