52 lines
867 B
C#
52 lines
867 B
C#
using System.Collections;
|
|
|
|
namespace RhSolutions.ExcelExtensions;
|
|
|
|
public class ColumnsEnumerator: IEnumerator<Column>
|
|
{
|
|
private Columns _columns;
|
|
private int position = -1;
|
|
object IEnumerator.Current
|
|
{
|
|
get
|
|
{
|
|
return Current;
|
|
}
|
|
}
|
|
|
|
public Column Current
|
|
{
|
|
get
|
|
{
|
|
try
|
|
{
|
|
return _columns[position];
|
|
}
|
|
catch (IndexOutOfRangeException)
|
|
{
|
|
throw new InvalidOperationException();
|
|
}
|
|
}
|
|
}
|
|
|
|
public ColumnsEnumerator(Columns columns)
|
|
{
|
|
_columns = columns;
|
|
}
|
|
|
|
public bool MoveNext()
|
|
{
|
|
position++;
|
|
return (position < _columns.Length);
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
position = -1;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
|
|
}
|
|
} |