The introduction of the
Task type in .NET 4.0 provides for a way to standardize on the object representation of an operation’s eventual completion. In fact, tasks are sometimes referred to as futures, clearly indicating their nature of having a result in the future.
Looking back at the APM, you might wonder whether we don’t already have such a type in the form of the
IAsyncResult interface. Although they share some similarities, a couple of drawbacks apply to using this type when representing futures. One problem is the separation of callbacks from the object representing the operation. Another one is the absence of the operation’s result on the
IAsyncResult object itself. In other words, this type can’t ...