RhSolutions-AddIn/RhSolutions.ExcelExtensions/Row.cs
2023-04-01 15:58:42 +03:00

34 lines
702 B
C#

using System.Collections;
namespace RhSolutions.ExcelExtensions;
public sealed class Row : Table, IEnumerable<TableCell>
{
public int Index
{
get => Range.Row - ParentTable.Range.Row;
}
public int Length
{
get => Range.Columns.Count;
}
public Row(Range range, Table table) : base(range, table)
{
Range = range;
ParentTable = table;
}
public TableCell this[int index]
{
get => new(Range.Cells[1, index + 1], ParentTable);
}
public IEnumerator<TableCell> GetEnumerator()
{
return new RowEnumerator(Range, ParentTable);
}
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}