.NET Framework TPL Dataflow

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

Libraries Used in Examples

System.Threading.Tasks.Dataflow

System.Threading.Tasks

System.Net.Http

System.Net

Difference between Post and SendAsync

To add items to a block you can either use Post or SendAsync.

Post will try to add the item synchronously and return a bool saying whether it succeeded or not. It may not succeed when, for example, a block has reached its BoundedCapcity and has no more room for new items yet. SendAsync on the other hand will return an uncompleted Task<bool> that you can await. That task will complete in the future with a true result when the block cleared its internal queue and can accept more items or with a false result if it's declining permanently (e.g. as a result of cancellation).



Got any .NET Framework Question?