Events Vs Method difference please?

Posted by Naga116 under C# on 8/4/2011 | Points: 10 | Views : 7949 | Status : [Member] | Replies : 2
Can you please provide the difference of Events vs Method?

Nagaraju


Responses

Posted by: Hmanjarawala on: 8/4/2011 [Member] Bronze | Points: 25

Up
0
Down
Method is Member function of class that are called with or without class Instance and called from inside or outside of class.

An event is an object that is fired by (another) object and sent to zero or more
'listeners'. Listeners have ordinary methods that are supposed to 'handle' the
event. Listeners are also objects and objects have 'behaviour' implemented by
methods.

methods can be overloaded, shadowed or overriden, but events could not. it can be handled by its predefined handlers

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Naga116, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: CS1401 on: 8/5/2011 [Member] Starter | Points: 25

Up
0
Down
simply method is user defined one.
But event is closely related to that control. for example in button control clicked, onmouseover these are triggered when that event occurs.

...

Naga116, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response