using System.Collections;
using System.Collections.Generic;
foreach (int n in new Pairs(1, 10))
class Pairs : IEnumerable<int>
public Pairs(int min, int max)
class ÉnumPairs : IEnumerator<int>
Pairs Source { get; init; }
public ÉnumPairs(Pairs source)
Cur = Source.Min % 2 == 0 ? Source.Min - 2 : Source.Min - 1;
if (Cur + 2 > Source.Max) return false;
public int Current => Cur;
object IEnumerator.Current => throw new NotImplementedException();
public void Dispose() { }
public IEnumerator<int> GetEnumerator() => new ÉnumPairs(this);
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() =>
throw new NotImplementedException();