Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I know events uses delegates in bottom.

But shall event works without delegates?
Posted
Updated 16-Sep-13 1:29am
v3
Comments
Sriram Bala 16-Sep-13 7:36am    
Hi,
http://shop.oreilly.com/product/9780596521073.do?cmp=af-orm-msdn-book-9780596521066 - Chapter 17. Events in C# are implemented with delegates. The publishing class defines a delegate. The subscribing class does two things: first, it creates a method that matches the signature of the delegate, and then it creates an instance of that delegate type encapsulating that method. When the event is raised, the subscribing class's methods are invoked through the delegate.
Happy reading.
Sriram.B

1 solution

Basically, no.

Delegates are basically references to functions, and without some mechanism like that, events could not function, and we would be back to the older Windows way of manually processing a message loop.
There is a lot written about how events work, but there is a good description here: http://www.ikriv.com/dev/dotnet/delegates.html[^] and Events and event handling in C#[^] is helpfull (if rather old) as well.
 
Share this answer
 
Comments
Sandesh M Patil 16-Sep-13 8:37am    
Thanks +5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900