title: Can I cast from an interface to a concrete type with another interface implementation
body: <p>I should start by saying that I am very much a noobie with interfaces so this might be a really dumb question.  Also apologies if my Title is unclear - matches the state of my mind!</p>
  
  <p>I do understand the principles behind interfaces and I am want to use them here both to support unit testing and also decoupling via a DI Framework in what is horribly messy and un-testable legacy code.</p>
  
  <p>I have an inteface called IDatHandler.  It has a List&lt;> property called Items.  The concrete implementations should return a concrete type of IDatContainer.  There are some methods of course but I have left them out</p>
  
  <pre><code>public interface IDatHandler
  {
      ....
  
     List&lt;IDatContainer&gt; Items
      {
          get; set;
      }
  
  }
  </code></pre>
  
  <p>This is a concrete implementation:</p>
  
  <pre><code>public class ADEColorHandler : IDatHandler
      {
        ....
  
          public List&lt;ADEColor&gt; Items
          {
              get; set;
  
          }
  
      }
  }
  </code></pre>
  
  <p>ADEColor implements IDatContainer. The concrete implementation fails unless I replace <code>ADEColor</code> with <code>IDatContainer</code>.</p>
  
  <p>Is there a way to get Items returned as a list of type <code>ADEColor</code> or am I just breaking the rules?</p>
  
  <p>I should have said that this app is currently using NET 3.5</p>
  
  <p><strong>=========>>> The Answer - thanks Charleh!</strong></p>
  
  <p>The IDatHandler Interface</p>
  
  <pre><code>public interface IDatHandler&lt;T&gt; where T : IDatContainer
  {
      ....
  
     List&lt;IDatContainer&gt; Items
      {
          get; set;
      }
  
  }
  </code></pre>
  
  <p>The concrete Class:</p>
  
  <pre><code>public class ADEColorHandler : IDatHandler&lt;ADEColor&gt;
          {
            ....
  
              public List&lt;ADEColor&gt; Items
              {
                  get; set;
  
              }
  
          }
      }
  </code></pre>
  
  <p>My units tests on ADEColorHandler Assert against this list and pass.</p>