title: How to raise parent class events with Expression (C#)
body: <p>I'm writing a class library for a Web API.</p>
  
  <p>I have a base class and an interface with 30 blocks like this:</p>
  
  <pre><code>interface ISomethingApi {
      void AuthenticateAsync(string username, string password);
      event AsyncResponseHandler AuthenticateEnded;
  
      void GetMemberAsync(string username);
      event AsyncResponseHandler&lt;Member&gt; GetMemberEnded;
  
      // more...
  }
  </code></pre>
  
  <p>The base class called BaseHttpClient contains the implementation and all methods are empty and virtual.</p>
  
  <pre><code>class BaseHttpClient : ISomethingApi {
  
      public virtual void GetMemberAsync(string username) {
          throw new NotImplementedException();
      }
  
      public event AsyncResponseHandler&lt;Member&gt; GetMemberEnded;
  
      // more...
  
  }
  </code></pre>
  
  <p>Because the API is pretty non-standard, I am inheriting the base class with a XmlClient class. This class overrides virtual methods and do the job.</p>
  
  <pre><code>class XmlClient : BaseHttpClient {
      public override void GetMemberAsync(string username) {
          Member member;
          // process here
  
          // raising the event
          GetMemberEnded(this, new AsyncResponseArgs&lt;Member&gt;(member));
          // error: LogoffEnded can only appear on the left hand side of += or -=
      }
  }
  </code></pre>
  
  <p>The problem is I can't raise the events: </p>
  
  <blockquote>
    <p>The event 'BaseHttpClient.LogoffEnded' can only appear on the left hand side of += or -=</p>
  </blockquote>
  
  <p>A basic solution is to create methods in the base class like </p>
  
  <pre><code>protected void RaiseLogoffEnded(AsyncResponseArgs args) {
      if (LogoffEnded != null) {
          LogoffEnded(this, args);
      }
  }
  </code></pre>
  
  <p>But there are too many methods to create. I'd like to do something like:</p>
  
  <pre><code>public override void GetMemberAsync(string username) {
      Member member;
      // work done here
  
      RaiseEvent(x =&gt; x.GetMemberEnded, new AsyncResponseArgs&lt;Member&gt;(member));
  }
  </code></pre>
  
  <p>I suppose this is about reflection and expressions.</p>
  
  <ul>
  <li>Is it a right way to do? (performace)</li>
  <li>What documentation could I read to make this?</li>
  <li>could you show me a valid code for this?</li>
  </ul>