title: Forwarding events in C#
body: <p>I'm using a class that forwards events in C#. I was wondering if there's a way of doing
  it that requires less code overhead.</p>
  
  <p>Here's an example of what I have so far.</p>
  
  <pre><code>class A
  {
     public event EventType EventA;
  }
  
  class B
  {
     A m_A = new A();
     public event EventType EventB;
  
     public B()
     {
        m_A.EventA += OnEventA;
     }
  
     public void OnEventA()
     {
        if( EventB )
        {
           EventB();
        }
     }
  }
  </code></pre>
  
  <p>Class A raises the original event. Class B forwards it as EventB (which is essentially the same event). Class A is hidden from other modules so they can't subscribe to EventA directly.</p>
  
  <p>What I'm trying to do is reduce the code overhead in class B for forwarding the event, as typically there's no real handling of the events in class B. Also I'll have several different events so it would require writing a lot of OnEvent() methods in class B that only serve to forward the events. </p>
  
  <p>Is it possible to automatically link EventA to EventB in some way, so I'd have something like this:</p>
  
  <pre><code>class B
  {
     A m_A = new A();
     public event EventType EventB;
  
     public B()
     {
        m_A.EventA += EventB; // EventA automatically raises EventB.
     }
  }
  </code></pre>
  
  <p>I'm using a C# 2.0 compiler btw.</p>