title: Events - naming convention and style
body: <p>I'm learning about Events / Delegates in C#.  Could I ask your opinion on the naming/coding style I've chosen (taken from the Head First C# book)?</p>
  
  <p>Am teaching a friend about this tomorrow, and am trying to come up with the most elegant way of explaining the concepts. (thought the best way to understand a subject is to try and teach it!)</p>
  
  <pre><code>class Program
      {
          static void Main()
          {
              // setup the metronome and make sure the EventHandler delegate is ready
              Metronome metronome = new Metronome();
  
              // wires up the metronome_Tick method to the EventHandler delegate
              Listener listener = new Listener(metronome);
              metronome.OnTick();
          }
      }
  </code></pre>
  
  <hr>
  
  <pre><code>public class Metronome
      {
          // a delegate
          // so every time Tick is called, the runtime calls another method
          // in this case Listener.metronome_Tick
          public event EventHandler Tick;
  
          public void OnTick()
          {
              while (true)
              {
                  Thread.Sleep(2000);
                  // because using EventHandler delegate, need to include the sending object and eventargs 
                  // although we are not using them
                  Tick(this, EventArgs.Empty);
              }
          }
      }
  </code></pre>
  
  <hr>
  
  <pre><code>public class Listener
      {
          public Listener(Metronome metronome)
          {
              metronome.Tick += new EventHandler(metronome_Tick);
          }
  
          private void metronome_Tick(object sender, EventArgs e)
          {
              Console.WriteLine("Heard it");
          }
      }
  </code></pre>
  
  <p>n.b. Code is refactored from <a href="http://www.codeproject.com/KB/cs/simplesteventexample.aspx" rel="noreferrer">http://www.codeproject.com/KB/cs/simplesteventexample.aspx</a></p>