Skip to content

A light library which contains useful helpers for batching any process (executing tasks in batches)

License

Notifications You must be signed in to change notification settings

ayyoubjadoo/Batch-Master

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Batch-Master

A light library which contains useful helpers for batching any process (executing tasks in batches)

Sample Usage

        List<int> myIntList = new List<int>();

        for (int i = 0; i < 100; i++)
        {
            myIntList.Add(i + 1);
        }

        var config = new ExecutionConfig
        {
            BatchSize = 30,
            BatchDelayInMS = 200 //this property will be ignored in the Parallel mode
        };

        Console.WriteLine("Normal:");
        var result = BatchMaster.Execute(myIntList, (batch) => { DoSomethingWithMyBatch(batch.ToList()); }, config);
        Console.WriteLine(result);

        Console.WriteLine("-------------------------------------");

        Console.WriteLine("Parallel:");
        var pResult = BatchMaster.ExecuteParallel(myIntList, (batch) => { DoSomethingWithMyBatch(batch.ToList()); }, config);
        Console.WriteLine(pResult);

        Console.ReadLine();

Made with love by Ayyoub Jadoo

About

A light library which contains useful helpers for batching any process (executing tasks in batches)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages