using System.Collections; namespace RhSolutions.ExcelExtensions; public class RowEnumerator : IEnumerator { public Range Range { get; } public Table ParentTable { get; } private int position = 0; object IEnumerator.Current { get { return Current; } } public TableCell Current { get { try { return new TableCell(Range.Cells[1, position], ParentTable); } catch (IndexOutOfRangeException) { throw new InvalidOperationException(); } } } public RowEnumerator(Range range, Table parentTable) { Range = range; ParentTable = parentTable; } public bool MoveNext() { position++; return (position <= Range.Columns.Count); } public void Reset() { position = 0; } public void Dispose() { } }