© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
7 replies
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;
}
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;
return dataSet;
if dataSet.Count == 5000
how can I do it?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ MSBuild: How to call own Task in the .csproj
C#CC# / help
3y ago
✅ How to run task in separate process?
C#CC# / help
3y ago
How to use use ReadKey in a Task when i'm using ReadKey elsewhere to stop the program from exiting?
C#CC# / help
4y ago
❔ Finding the right algorithm for this task 🤔
C#CC# / help
3y ago