Use enumerator explicitly
Property | Value |
---|---|
Id | RR0206 |
Applicable Syntax | foreach statement |
Syntax Span | foreach keyword |
Enabled by Default | ✓ |
Usage
Example #1
before.cs
foreach (var item in items)
{
yield return item;
}
after.cs
using (var en = items.GetEnumerator())
{
while (en.MoveNext())
{
yield return item;
}
}
Configuration
roslynator_refactoring.use_enumerator_explicitly.enabled = true|false