title: C# Generic Interface Type returning Null
body: <p>I've got a class <code>Table</code>, which returns a collection of <code>Entity</code>, such as:</p>
  
  <pre><code>Table&lt;Song&gt; table = database.GetTable("SongCollection");
  </code></pre>
  
  <p>Where <code>Song</code> is a subclass <code>Entity</code>. <code>Table</code> also implements an interface <code>ITable</code> and <code>Entity</code> implements an interface called <code>IEntity</code>.</p>
  
  <p>However, calling: </p>
  
  <pre><code>ITable&lt;IEntity&gt; table = database.GetTable("SongCollection");
  </code></pre>
  
  <p>or</p>
  
  <pre><code>ITable&lt;Entity&gt; table = database.GetTable("SongCollection");
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Table&lt;Entity&gt; table = database.GetTable("SongCollection");
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Table&lt;IEntity&gt; table = database.GetTable("SongCollection");
  </code></pre>
  
  <p>All return null.</p>
  
  <p>I can call <code>table.GetAll()</code> and return a <code>List&lt;Song&gt;</code> and cast each individual <code>Song</code> to an <code>IEntity</code> just fine.</p>
  
  <p>What should I be doing in the case of the <code>Table</code> though so that I don't have to return a <code>List&lt;dynamic&gt;</code> in order to get the <code>Table</code> when making for example an administrative interface for doing CRUD operations on all <code>Tables</code> generically?</p>