Posted By

kat on 05/11/10


Tagged

event delgate


Versions (?)

Custom Event


 / Published in: C#
 

  1. //The following goes in the class that will have the event and fire the event
  2.  
  3. public delegate void LogHandler(string message);
  4.  
  5. // Define an Event based on the above Delegate
  6. public event LogHandler Log;
  7.  
  8. set
  9. {
  10. m_RestartAnywhere = value;
  11.  
  12. //Notify clients
  13. if (Log!= null)
  14. {
  15. Log(this, value);
  16. }
  17. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: kat on May 11, 2010

The log should actually be renamed to XXhandler and the XXhandler should be renamed to the event name

You need to login to post a comment.