April 2018
Intermediate to advanced
300 pages
7h 41m
English
With TPL, we can use the IProgress<T> interface to get real-time progress notifications from the asynchronous operations. This can be used in scenarios where we need to update the user interface or the console app of asynchronous operations. When defining the TAP-based asynchronous methods, defining IProgress<T> in a parameter is optional. We can have overloaded methods that can help consumers to use in the case of specific needs. However, they should only be used if the asynchronous method supports them. Here is the modified version of SaveFileAsync that updates the user about the real progress:
static void Main(string[] args) { var progressHandler = new Progress<string>(value => { Console.WriteLine(value); }); var ...