O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Asynchronous Read and Write Operations

All the I/O operations explained in the previous sections have been of the synchronous kind, meaning the caller is blocked until the data becomes available. Often, it’s more appropriate to read or write data asynchronously, to prevent hangs of user interface (UI) threads and to increase scalability of services. The essential idea of asynchronous I/O is to start the request and get notified when the action has been completed.

This section examines how the Stream class supports this modus operandi. Even though C# 5.0 introduces a new improved way to deal with asynchronous operations (discussed in great lengths in Chapter 31, “Asynchronous Programming”), we’ll start off by explaining the old Asynchronous Programming ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required