using Workflow.Application.BuildFlow.Common.Services;
namespace BuildFlow.Workflow.Tests.Performance;
/// 枚举到指定索引时触发取消的 Excel 行序列。
public sealed class CancellingExcelRows(
IReadOnlyList rows,
int cancelAtIndex,
Action cancel) : IEnumerable
{
public IEnumerator GetEnumerator()
{
for (var index = 0; index < rows.Count; index++)
{
if (index == cancelAtIndex) cancel();
yield return rows[index];
}
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
=> GetEnumerator();
}