title: Why is the interface lost when using Linq?
body: <p>I came across something today that I found surprising and was hoping someone could explain to me what is happening. It appears that Linq enumerables can interfere with the interfaces implemented by objects. If you run this code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  
  public class Program
  {
      interface One
      {
          int id {get; set; }
      }
  
      class A : One
      {
          public int id {get; set; }
      }
  
      interface Two
      {
      }
  
      class B : A, Two
      {
      }
  
      public static void Main()
      {
          var list = new List&lt;One&gt;() { new B {id = 1} };
  
          var b1 = list.Where(x =&gt; x.id == 1);
          var b2 = list.First();
  
          Console.WriteLine(b1 is Two);
          Console.WriteLine(b2 is Two);
      }
  }
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>False
  True
  </code></pre>
  
  <p>I was expecting the same object to be returned by Where() and First(), but apparently the objects returned have different types. Can someone shed some light on this?</p>
  
  <p>Thanks!
  -Tom B.</p>