title: Invoke generic method on all the derived types in type hierarchy
body: <p>Let's say we have the following type hierarchy:</p>
  
  <pre><code>public abstract class Base {}
  public class A : Base {}
  public class B : Base {}
  </code></pre>
  
  <p>I need to perform the same operations on all the derived types from <code>Base</code>. This is what I came up </p>
  
  <pre><code>public IList&lt;T&gt; DoWork&lt;T&gt;(string entityPath) where T : Base {
      // get 'json' using 'entityPath'
      return JsonConvert.DeserializeObject&lt;List&lt;T&gt;&gt;(json);
  }
  </code></pre>
  
  <p>Now my problem is to somehow invoke <code>DoWork()</code> on all the derived classes in a for-loop in the consumer's class. What I was hoping to work was something like:</p>
  
  <pre><code>var entities = new Dictionary&lt;string, Type&gt; {
      ['a', TypeOf(A)],
      ['b', TypeOf(B)]
  }
  foreach(var e in entitties) {
      DoWork&lt;e.Value&gt;(e.Key)
  }
  </code></pre>
  
  <p>Which is obviously not working.</p>
  
  <p>If this approach is entirely flawed, I would love to know the alternatives.</p>