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