O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Progress Reporting

An additional parameter may be provided to report progress for the in-flight operation, using the IProgress<T> type. Just like the optional parameter to supply a CancellationToken, this parameter should appear after the operation’s core parameters. A null reference can be supplied by callers of the method to indicate no progress reports are desired. An example of a signature with progress reporting is shown here:

Task ProcessRecordsAsync(int categoryId, IProgress<int> progress);

This method could process a set of records from some store, matching the specified category identification number. The progress parameter allows tracking of the operation based on int values, which could denote the completion percentage. Callers of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required