Video: Creating Custom Events and Delegates with C#

It's no secret that events and delegates play a crucial role in the .NET framework.  Without them it would be hard to handle user input or notify other objects when an action occurs.  I get a lot of questions about events and delegates in classes I teach so I decided to put together a video that outlines the fundamentals of creating a custom class that exposes an event and a delegate.  The video also demonstrates how to create a custom  EventArgs class and how events can be consumed using C#.

View the Video


View other video tutorials

Thanks to Orcsweb for hosting my website ( and for giving me space to host videos!  If you're looking for a host I highly recommend them.  You won't find better service anywhere.

comments powered by Disqus


  • Great example. Now how would you call it asynchronously so it dosen't lock up the UI?

  • There are several different ways to do that including delegates, spawning your own threads, etc., but the easiest way (IMHO) is to use the BackgroundWorker control built into .NET V2 Windows Forms.

  • Can you give me an example? I have found a bunch of stuff about backgroundworker but can't seem to get it to work on a class from a different code file than the form.

  • If I get a chance I'll post a sample but in all honesty it probably won't happen soon due to other priorities I have right now.

  • thanks for the video and wondering can be used same for ?


  • ASP.NET doesn't deal well with callbacks since a callback method may be called after the page's lifecycle has finished and it renders. So, you'll need to look at other options such as WaitHandles, Polling or the new Async attribute on the Page directive used in conjunction with PageAsyncTasks. You'll find some info on this and samples if you search my blog for Asynchronous Web Services.

Comments have been disabled for this content.