title: C# Event Handling involving publisher subscriber not working
body: <p>I have a publisher class and a subscriber class. The publisher class has an event and the subscriber wants to execute one of its own methods when this event is raised.</p>
  
  <p>Here is my publisher class with its event:</p>
  
  <pre><code>public delegate EventHandler&lt;MyEventArgs&gt; MyEventHandler(object sender, MyEventArgs args);
  public class MyEventArgs : EventArgs
  {
      public string Content { set; get; }
  }
  
  public class Publisher
  {
      public event MyEventHandler MyCustomEvent;
  
      public void TriggerEvent()
      {
          if(MyCustomEvent!=null)
              MyCustomEvent(this, new MyEventArgs{ Content = "Geeee! This isn't working!" });
      }
  }
  </code></pre>
  
  <p>And here is the subscriber:</p>
  
  <pre><code>class Subscriber
  {
      static void Main(string[] args)
      {
          Publisher publisher = new Publisher();
  
          //hook the event to a method
          publisher.MyCustomEvent += (s, e) =&gt; delegate
          {
              PrintThis(e.Content);
          };
  
         //Do something to trigger the event    
          publisher.TriggerEvent();
      }
      static public void PrintThis(string content)
      {
          Console.Write(content);
      }
  }
  </code></pre>
  
  <p>The publisher should not be aware of the subscriber. I want the subscriber to be able to execute its PrintThis function when the publisher invokes the event. But this is not working. What am I doing wrong here? </p>