RhSolutions-AddIn/RhSolutions.ExcelExtensions/RowsEnumerator.cs
2023-04-06 08:29:39 +03:00

52 lines
832 B
C#

using System.Collections;
namespace RhSolutions.ExcelExtensions;
public class RowsEnumerator : IEnumerator<Row>
{
private Rows _rows;
private int position = -1;
object IEnumerator.Current
{
get
{
return Current;
}
}
public Row Current
{
get
{
try
{
return _rows[position];
}
catch (IndexOutOfRangeException)
{
throw new InvalidOperationException();
}
}
}
public RowsEnumerator(Rows rows)
{
_rows = rows;
}
public bool MoveNext()
{
position++;
return (position < _rows.Length);
}
public void Reset()
{
position = -1;
}
public void Dispose()
{
}
}