Asynchronous Programming Model

The oldest of the asynchronous programming patterns was introduced right from the start, with .NET Framework 1.0. We’ve already covered this pattern in passing in Chapter 17, “Delegates,” and in Chapter 28, “Working with I/O.” Nonetheless, let’s revisit this pattern briefly and identify its core characteristics.

This pattern consists of two related methods, using a Begin and End prefix convention. For example, asynchronous read operations on a Stream object are defined as follows:

IAsyncResult BeginRead(byte[] buffer, int offset, int count,                       AsyncCallback callback, object state);int EndRead(IAsyncResult asyncResult);

The BeginRead method takes all the required parameters ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.