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

Method Naming and Overloading

Part of all the asynchronous patterns is convention. This is no different for the TAP. The first guideline is to give the method an Async suffix in its name. In case there’s already such a method for the EAP, the alternative TaskAsync suffix is picked. A good example of this is the WebClient class, which we explored in the previous section. For types that were based on the APM, no such conflict exists. A good example is on the FileStream class, which has the following members for Read and Write operations in .NET 4.5:

// Sychronous methodsabstract int Read(byte[] buffer, int offset, int count);abstract void Write(byte[] buffer, int offset, int count);// APM methodsvirtual IAsyncResult ...

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