Visual studio feeds

All Visual Studio blogs in one place

Subscribe

Enter your email address:

Delivered by FeedBurner

Increase your website traffic with Attracta.com

Google+

Contact

Email:
Subject:
Message:
Anti-spam: How many eyes has a typical person?

Follow us on FB

Search

Async using the old Async Begin / End Pattern

AddThis Social Bookmark Button
  In the last few weeks I have had the pleasure of familiarising myself with various async patterns in C#. After going through the different approaches one gets a feel for how far we have come since the .Net 1 days. One particular pattern that I was not familiar with implementing but which has been available since the beginning of .Net is what I call the Async Begin / End Pattern. Since my interest is really making calls asynchronously so that I don’t block the UI thread - from what I can tell this is one of
the more complicated approaches to achieve this, but useful to know of where we have come from. So the approach I am going to illustrate is one where we pass a delegate for a callback method to BeginInvoke. The method is executed on a ThreadPool thread when the asynchronous call completes. The callback method calls EndInvoke. Let’s look at the synchronous implementation first… Take a WPF project with one window and a button with a click event behind it. Implement the following code… using System.Threading; using System.Windows; namespace WpfApplicationTemp { public partial class...(Read whole news on source site)

Home : Blog List : Mark Pearl : Async using the old Async Begin / End Pattern