title: Extension Method for Interface in Internal Class
body: <p>I am currently trying to write extensions to <a href="https://dynamiclinq.codeplex.com/" rel="nofollow">Dynamic Linq</a>. For that I need to add a method signature to the <code>IEnumerableSignatures</code> interface located in the internal class <code>ExpressionParser</code>. </p>
  
  <pre><code>internal class ExpressionParser
  {
      interface IEnumerableSignatures
      {
          [...]
      }
  }
  </code></pre>
  
  <p>While I could add the signature to the code directly, I'd rather define this as an extension method to the interface, to keep the original code clean. Usually, to add the method <code>DefaultIfEmpty</code>, I would do something like this:</p>
  
  <pre><code>internal static class Extension 
  {
      static void DefaultIfEmpty(this ExpressionParser.IEnumerableSignatures sig);
  }
  </code></pre>
  
  <p>This gives an access error though, because <code>ExpressionParser</code> is internal. I have already tried with several combinations of access level for the class and method.</p>
  
  <p>Is there a way to add an extension method to such an interface or do I have to mess with the original code?</p>
  
  <p><strong>[edit]</strong> Turns out that, even when making the interface itself internal (or public for that matter), it is not recognized by dynamic linq. I still got some not-found exception on runtime. So there's no (obvious) way around editing the codeplex code. <strong>[/edit]</strong></p>