Jump to content

C Sharp Programming/Asynchronous Programming

From Wikibooks, open books for an open world

C# has built in Asynchronous Programming support from as early as .NET Framework 1.1. Asynchronous Programming generally refers to a method of concurrent programming that allows a unit of task to run separately, and calls back to the main thread when the task is completed or failed. This programming pattern can be used in operations including web service calls, database calls, or other CPU bound operations.

Asynchronous Programming Model (APM) pattern

[edit | edit source]

The APM pattern is often referred to as the IAsyncResult pattern, where methods named BeginMethodName, and EndMethodName are used to perform asynchronous operations. However, since the introduction of the EAP and TAP pattern, the APM pattern is no longer recommended.

Event-based Asynchronous Pattern (EAP)

[edit | edit source]

Task-based Asynchronous Pattern (TAP)

[edit | edit source]