Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 799 Bytes

RR0188.md

File metadata and controls

35 lines (25 loc) · 799 Bytes

Convert 'foreach' to 'for' and reverse loop

Property Value
Id RR0188
Title Convert 'foreach' to 'for' and reverse loop
Syntax foreach statement
Enabled by Default -

Usage

Before

foreach (object item in items)
{
    yield return item;
}

After

for (int i = items.Count - 1; i >= 0; i--)
{
    yield return items[i];
}

See Also

(Generated with DotMarkdown)