23 lines
686 B
C#
23 lines
686 B
C#
using Workflow.Application.BuildFlow.Common.Services;
|
|
|
|
namespace BuildFlow.Workflow.Tests.Performance;
|
|
|
|
/// <summary>枚举到指定索引时触发取消的 Excel 行序列。</summary>
|
|
public sealed class CancellingExcelRows(
|
|
IReadOnlyList<ExcelParsedRow> rows,
|
|
int cancelAtIndex,
|
|
Action cancel) : IEnumerable<ExcelParsedRow>
|
|
{
|
|
public IEnumerator<ExcelParsedRow> 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();
|
|
}
|