title: Exception when casting from concrete class to interface in LINQ query
body: <p>I have a class SomeClass, which can populate itself from a datarow in it's constructor. This class implements IInterface. However, when I execute the code below:</p>
  
  <pre><code>Dim fpQuery As IEnumerable(Of IInterface) = _
      From dr As DataRow In DataLayer.SomeMethodToGetADataTable.AsEnumerable _
      Select New SomeClass(dr)
  </code></pre>
  
  <p>I get the error </p>
  
  <pre><code>Unable to cast object of type 
  'System.Data.EnumerableRowCollection`1[Classes.SomeClass]' 
  to type
  'System.Collections.Generic.IEnumerable`1[Interfaces.IInterface]'
  </code></pre>
  
  <p>I should probably add that the following code works fine.</p>
  
  <pre><code>Dim fpQuery As IEnumerable(Of SomeClass) = _
      From dr As DataRow In DataLayer.SomeMethodToGetADataTable.AsEnumerable _
      Select New SomeClass(dr)
  </code></pre>
  
  <p>As does the simple cast</p>
  
  <pre><code>Dim myInterface As IInterface = New SomeClass(myDataRow)
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>EDIT :
  Jon Skeet got it spot on. I used the following code and it worked perfectly.</p>
  
  <pre><code>Dim fpQuery2 As IEnumerable(Of IInterface) = fpQuery.Cast(Of IInterface)
  </code></pre>