.NET Framework Using IProgress


Example

It's important to note that the System.Progress<T> class does not have the Report() method available on it. This method was implemented explicitly from the IProgress<T> interface, and therefore must be called on a Progress<T> when it's cast to an IProgress<T>.

var p1 = new Progress<int>();
p1.Report(1); //compiler error, Progress does not contain method 'Report'

IProgress<int> p2 = new Progress<int>();
p2.Report(2); //works

var p3 = new Progress<int>();
((IProgress<int>)p3).Report(3); //works