mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 00:42:51 +08:00
37 lines
783 B
C#
37 lines
783 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Spectre.Console
|
|
{
|
|
internal sealed class TableRowEnumerator : IEnumerator<TableRow>
|
|
{
|
|
private readonly TableRow[] _items;
|
|
private int _index;
|
|
|
|
public TableRow Current => _items[_index];
|
|
object? IEnumerator.Current => _items[_index];
|
|
|
|
public TableRowEnumerator(TableRow[] items)
|
|
{
|
|
_items = items ?? throw new ArgumentNullException(nameof(items));
|
|
_index = -1;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
}
|
|
|
|
public bool MoveNext()
|
|
{
|
|
_index++;
|
|
return _index < _items.Length;
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
_index = -1;
|
|
}
|
|
}
|
|
}
|