title: C# - Casting a Generic Delegate to a Non Generic Delegate
body: <p>I have a generic delegate that accepts a argument, <code>Args&lt;T&gt;</code>. I also have a normal delegate which accepts <code>Args</code>.</p>
  <pre class="lang-cs prettyprint-override"><code>delegate Task ExampleDelegate&lt;T&gt;(Args&lt;T&gt; args)
  
  delegate Task ExampleDelegate(Args args)
  </code></pre>
  <p><code>Args&lt;T&gt;</code> extends from <code>Args</code></p>
  <pre class="lang-cs prettyprint-override"><code>public class Args {
  
  }
  
  public class Args&lt;T&gt; : Args {
  
  }
  </code></pre>
  <p>I am currently extending my non generic interfaces/classes which use <code>ExampleDelegate</code> to create new generic interfaces/classes using <code>ExampleDelegate&lt;T&gt;</code>.</p>
  <p>Since all of them extend the non-generic versions, it has been painless to extend them so far until I had to override a method which accepts <code>ExampleDelegate</code>.</p>
  <p>I haven't been able to cast <code>ExampleDelegate&lt;T&gt;</code> into <code>ExampleDelegate</code> since the signatures don't match.</p>
  <p>One of the ways I was able to this was,</p>
  <pre class="lang-cs prettyprint-override"><code>ExampleDelegate&lt;SomeClass&gt; genericDelegate= //some method
  
  //First case
  ExampleDelegate nonGenericDelegate = args =&gt; genericDelegate(args as Args&lt;SomeClass&gt;);
  
  //Second case
  genericDelegate = argsT =&gt; nonGenericDelegate(argsT);
  </code></pre>
  <p>Is there any better way of doing this?</p>
  <p>Update:
  Is it possible to do this without creating an anonymous method like the one above?</p>