C#C
C#3y ago
SWEETPONY

✅ how to stop the task in this case?

I have following method:
private async Task<ReportDataSet> PrepareDataSet()
{
    var dataSet = new ReportDataSet();

    await _archiveClient.QueryChunks(
        arguments: new()
        {
            TimestampInterval = _parameters.TimestampInterval,
            EventCategories = _parameters.EventCategories,
            EventNames = _parameters.EventNames,
            OperatorIDs = _parameters.OperatorIDs,
            SubjectIDs = _parameters.SubjectIDs,
            DepartmentIDs = _parameters.DepartmentIDs,
            TerritoryIDs = _parameters.TerritoryIDs,
            AccessPointIDs = _parameters.AccessPointIDs
        },
        chunkCallback: async items => await FillDataSetChunk(dataSet, items),
        parameters: new()
        {
            User = _context.Principal.Name
        } );

    return dataSet;
}


I wanna stop chuckCallback and return dataSet; if dataSet.Count == 5000
how can I do it?
Was this page helpful?