You must Sign In to post a response.
  • Category: ASP.NET

    What is the difference between an Event and Delegate

    Hi!
    What is the difference between an Event and Delegate?
    Please explain with examples
    Thank you in advance

    Regards
    Kamlesh
  • #648521
    Event

    some message sent by an object to do few action. ex.. mouse click event

    delegates
    it hold areference to a method.

    hope this help!

    thnx
    Muhil

  • #648566
    Event means an action
    Delegate is a class holds a reference to a method.

    Actually events use delegates in bottom. Events add an extra layer on the delegates, thus forming the publisher and subscriber model.

  • #648578
    An event offers more restricted access than a delegate.

    Dalegete is a function pointer which can able to store the address of any function with same prototype.

    Event is a function handler which can handles or run the functions in same prototype of its delegate.

    For handling events delegate is uesd.

    Regards
    Mr.Rajesh
    Software Engg.

  • #648619
    Event is nothing but that triggers an actions

    Delegate is the one which holds the evnmt for certain actions that cannot be done with the event

    For example, you have a method which writes a log into a log file in asynchronous mode

    The Page load event can handle only the load event it cannot trigger in an asynchronous way

    here the delegate would hold the writelog method, using iasynchronous interface it will call the method in teh delegate in an asynchrouous way

    Please mark this as Answer, if this helps

    Regards,
    Alwyn Duraisingh.M 
    << Database Administrator >>
    Jesus saves! The rest of us better make backups...

  • #648649
    *Delegate is a action whereas event is a handler to handle delegate.
    *Delegate can fire only one method
    But Event fire more than one delegate , each call one method

    Delegate is a class to fire the event..like
    button is a class and after click, it fire event.


    Thank u.

  • #648890
    Thank you everybody for answering my question

    Regards
    Kamlesh

    Regards
    Kamlesh Mohanty


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.