2What is Async I/O?Executing I/O in the background, allowing foreground work to proceedI/O executes and completes in parallel with, and independent of, the application that initiated itCalled “Overlapped I/O” in Win32
4Why use Async I/O? Scalability Throughput Threads are expensive Non-blocking UISilverlight
5Why not Async I/O?ComplexityDebuggabilityUnnecessary?
6Asynchronous Programming Model Standard pattern for async work in .NET 3.5Convert: string DoOperation(int param1, double param2); Into: IAsyncResult BeginDoOperation(int param1, double param2, AsyncCallback callback, object state); string EndDoOperation(IAsyncResult asyncResult);In WCF, use [OperationContract(AsyncPattern = true)]
7Asynchronous Programming Model Four ways to complete asynchronous call:Supply an AsyncCallbackPoll IAsyncResult.IsCompletedWait on IAsyncResult.AsyncWaitHandle (blocking)Call EndXxx method (blocking)Always call EndXxx method!