Home About

 November 18th, 2008

Using Delegates in C# - 1

What is a delegate and why would you want to use them?

Calling methods with parameters comes natural in programming, but what if you would like to pass the methods themselves to another method?

To give an example: You might want to set a timer and have the timer call a particular method when the time comes. To avoid having to hard code each possible action together with its own timer you might want to pass the action method in your call to the timer itself. In C# this is called delegation.

Read the rest of this entry »


Recent Comments
  • Ales: Hi, Thanks for the code… I must say I did not experience any errors decrypting any of my messages. I even...
  • JC: Thanks very useful and well explained
  • Thomas: This is a public static class written in the C# language that does not save state. You can call into the...
  • Simon: Thank you very much for this post! It helped me essentially to overcome obstacels to work with mono!
  • Graham: This is a good research for keyboard shortcuts! Some shortcuts are also compatible for Windows OS. I have...