40 lines
826 B
C#
40 lines
826 B
C#
using System.Collections;
|
|
|
|
namespace RhSolutions.ExcelExtensions;
|
|
|
|
public class Rows : IEnumerable<Row>
|
|
{
|
|
public Range Range { get; }
|
|
public Table ParentTable { get; }
|
|
public int Length
|
|
{
|
|
get => Range.Rows.Count;
|
|
}
|
|
|
|
public Rows(Range range, Table parentTable)
|
|
{
|
|
Range = range;
|
|
ParentTable = parentTable;
|
|
}
|
|
|
|
public Row this[int index]
|
|
{
|
|
get
|
|
{
|
|
if (index < 0 || index + 1 > Range.Rows.Count)
|
|
{
|
|
throw new IndexOutOfRangeException();
|
|
}
|
|
|
|
return new Row(Range.Rows[index + 1], ParentTable);
|
|
}
|
|
}
|
|
|
|
public IEnumerator<Row> GetEnumerator()
|
|
{
|
|
return new RowsEnumerator(Range, ParentTable);
|
|
}
|
|
|
|
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
|
}
|