52 lines
832 B
C#
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()
|
|
{
|
|
|
|
}
|
|
} |