Events Are Not Delegates – but look like they are

Following on from the Delegates post…

I have always thought that Events in C# are delegates; or at least are involved with them – but I’m wrong! ( not for the first time nor the last)

Again- taken from TAKEN FROM C# In Depth Third Edition  Just read this explanation

Continue reading →

Advertisements

Delegates

TAKEN FROM C# In Depth Third Edition 

A delegate in C# acts like your will does in the real world – it allow you to specify a sequence of actions to be executed at the appropriate time.

In order for a delegate to do anything, four things need to happen:

  • The delegate type needs to be declared
  • The code to be executed must be contained in a method
  • A Delegate instance must be created
  • The delegate instance must be invoked

Continue reading →