Hello Folks,
I've a table with 50 hundred records which I need to send as email or sms (daily) through C#.
Instead to use one-by-one to send email, I've two options
1. Async Programming with TPL (Task Parallel Library) using await & async
2. Multi-threading programming in C#
I believe that I should use multi-threading in C# as TPL doesn't do tasks at same time. Right?
Apart, in multi-threading C#, do you have code snippet for below use case in C#?
1. Use Thread-Pool
2. Use configurable threads & chunk size like 2 threads with 5 chunk size, means one thread will handle 5 records at same time
3. Addition, in case any records completed (email sent) by thread out of 5 records. Example, 1 record' email sent then queue next record with same thread. So that thread should not wait to complete all 5 records to finish.
Do you have other thoughts too?
Best Regards,
Mohit Pandit
Our community of experts have been thoroughly vetted for their expertise and industry experience.