Wednesday, May 18, 2011

C# and VB Future: Async Made Simple

The presenter either didn't mention his name or I missed it. Here is a summary of what I saw.



  • The next version of Visual Studio, called vNext, will contain a lot of enhanced support for Async calls. Namely some new keywords, such as Async and Await.

  • Apparently as of .NET 4 there is something called Tasks which I still need to fully understand but these will work with the new vNext keywords.

  • He demonstrated how looping logic can be very problematic for the "standard" way of dealing with Async calls.

  • He went on to demonstrate the new Async CTP and the new keywords mentioned above.

  • He also showed the new CancellationToken and how that works. This can be used in client.dosomethingAsync calls

  • He also showed in c# how to set up a delegate to run an anonymous block of code. This isn't new but I thought it was pretty cool.

  • He then, finally, loaded up some VB code to demostrate the new WCF enhancements. the syntax for the new stuff in VB is something like this:

Public Async Function doSomething() as Task (of objCustom)


.....


Dim something = Await clientProxy.doSomethingAsync


....


End Function



  • There is also something called Task.WhenAll which waits for everything in the parameters list to come back before exiting.

No comments:

Post a Comment