Explaining Delegates in C# - Part 7 (Asynchronous Callback - Way 4)

by rahul 1/25/2009 6:55:00 AM
This is the final part of the series that started with... Callback and Multicast delegates Events One more Event Asynchronous Callback - Way 1 - BeginInvoke > EndInvoke Asynchronous Callback - Way 2 - BeginInvoke > AsyncWaitHandle.WaitOne(x) > EndInvoke > AsynWaitHandle.Close() Asynchronous Callback - Way 3 - BeginInvoke > Poll for result's IsCompleted > EndInvoke In this scenario, if we go with the husband-wife-kiddo analogy, I will need to introduce another guy! No no... [More]


Explaining Delegates in C# - Part 6 (Asynchronous Callback - Way 3)

by rahul 1/23/2009 9:02:56 AM
By now, I have shown the following usages of delegates...     Callback and Multicast delegates    Events    One more Event    Asynchronous Callback - Way 1 - BeginInvoke > EndInvoke    Asynchronous Callback - Way 2 - BeginInvoke > AsyncWaitHandle.WaitOne(x) > EndInvoke > AsynWaitHandle.Close() In this part, we will take a look at how you could use polling to figure out if the Asynchronous call is complete. So,... [More]


Explaining Delegates in C# - Part 5 (Asynchronous Callback - Way 2)

by rahul 1/22/2009 4:28:21 AM
In this part of making asynchronous programming with delegates, we will talk about a different way, which is a little better than Way 1. In the previous post, it was like a husband telling his wife... You know honey, I have a lot of work to do. Why don't you help me up by doing something that you can do pretty well . In the meantime, I will take care of some other stuff. As soon as I am done, I promise I will pick you up. Notice that, although it looks like a good way of getting the work done, i... [More]


Explaining Delegates in C# - Part 4 (Asynchronous Callback - Way 1)

by rahul 1/22/2009 4:25:32 AM
So far, I have discussed about Callback, Multicast delegates, Events using delegates, and yet another example of events using delegates. In this post, I will take this topic one step forward and show you an example of Asynchronous callbacks using delegates. Let's say a client calls a method that takes 40 minutes to complete, how do we communicate with the client?     Option 1> Keep showing that busy Cursor for 40 minutes!!!    Option 2> Keep updating the clie... [More]


Explaining Delegates in C# - Part 3 (Events again)

by rahul 1/20/2009 12:57:14 PM
I was thinking that the previous post on Events and Delegates was quite self-explanatory. A couple of days ago, I received an email which said that may be it is not that good as to explain what I want to achieve in life through that event. So, I thought why not write another post on Delegates and Events to make things clearer from a practical (or may be not so practical, "BUT" just another simple and practical example. There is no harm in trying, after all...) Here is the requirement... You have... [More]


Explaining Delegates in C# - Part 2 (Events)

by rahul 12/17/2008 3:39:39 AM
In my previous post, I spoke about a few very basic and simple reasons of using delegates - primarily callback. In this post, I'll talk about creating Events using delegates. I have tried to annotate the class with comments so that it is easy to comprehend. But IMHO, the best way to figure out what's going on is to copy/paste the following code and create breakpoint in the Main() class and hit F11 to step into the code. You will notice that Events are based on the Observer or Publish/Subscribe d... [More]


Explaining Delegates in C# - Part 1 (Callback and Multicast delegates)

by rahul 12/15/2008 3:00:09 PM
I hear a lot of confusion around Delegates in C#, and today I am going to give it shot of explaining the stuff with easy to understand examples. First things first... I will consciously try NOT to use any technical jargon to explain this concept. So here we go, without giving any technical explanation, let's start with a console application...// Declaration public delegate void VerySimpleDelegate(); class TestDelegate { public static void Foo() { Console.WriteLine("Foo wa... [More]


Search


Tags



Categories

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

All Items
Sign in

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2010, Rahul Soni

Powered by BlogEngine.NET 1.4.5.0