Saturday, May 7, 2011

Ease your Silverlight / WCF interaction with lambda expressions

Say you have a service like so :
And a user control in silverlight to display the last result of DoWork:
The common approach I see taken in the client application is this (which I don't like):

I have seen this pattern quite a number of times and I find the call to WCF service being at one place and the call back for it being at another quite annoying.

I very much appreciate the lambda syntax awesomeness of C# as shown:


PS: I can barely wait for the WCF vNext that will come with Async CTP support : http://blogs.msdn.com/b/endpoint/archive/2010/11/13/simplified-asynchronous-programming-model-in-wcf-with-async-await.aspx

No comments:

Post a Comment