Asynchronous Programming Model (APM)

The Asynchronous Programming Model (APM) is one of the oldest patterns introduced by Microsoft in .NET 1.0 back in 2001 for asynchronous programming handling.

The pattern is easy. To start a deferred job, you simply start such a job by using a Delegate (remote method invoker) and then get an object back of type IAsyncResult to know the status of such a remote operation. Here an asynchronous programmed application to compute file hashes. The application will add a "." to the Starting data computation initial message to acknowledge to the user that the application is still processing. The following examples use the blocking approach:

static void Main(string[] args) { //a container for data var complexData = new ...

Get Learning .NET High-performance Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.