I'm having an interface
ProgressReporter which basically takes a list of input items (the working queue) through a method
SetWorkPackages(IEnumerable<T> workPackages) and then has another method
FinishedWorkPackage(T workPackage) to indicate that one package has been finished.
It will then handle this the correct way, i.e. display a new percentage number, update a progress bar on the UI, whatever is implemented.
Using generics, I have to call it like this:
var cpr = new ConsoleProgressReporter<WorkPackage>(); cpr.SetWorkPackages(...); cpr.FinishedWorkPackage(...);
Actually, I have the feeling that the user does not really care about the type
T, because he never gets results back through the API. Even internally in the current implementations, it does not matter what type
Is it ok in such cases, to just allow
object instead of using generics? Are there general guidelines when to use generics and when to use