title: Unable to cast object of type '<XYPairsInRange>d__8' to type 'IXYPair'
body: <p>in <code>EnumerablePointEnumerator&lt;T&gt;.GetCurrent(ref Point p)</code> (<code>Microsoft.Research.DynamicDataDisplay.DataSources</code>) I'm getting an error <code>Unable to cast object of type '&lt;XYPairsInRange&gt;d__8' to type 'IXYPair'.</code></p>
  
  <p>XYPairsInRange is not a type, but a method of my class, of return Type IEnumerable</p>
  
  <pre><code>public IEnumerable&lt;IXYPair&gt; XYPairsInRange(double startX, double endX)
  {
     foreach (IXYPair pair in this.XYPairs)
     {
        if (pair.X &gt;= startX &amp;&amp; pair.X &lt;= endX)
        {
           yield return pair;
        }
     }
  }
  
  public IEnumerable&lt;IXYPair&gt; XYPairs
  {
     get
     {
         int counter = 0;
         foreach (double x in XValues)
         {
            yield return new XYPair() { X = x, Y = YValues[counter++] };
         }
     }
  }
  </code></pre>
  
  <p>IXYPair is defined as </p>
  
  <pre><code>public interface IXYPair
  {
      double X { get; }
      double Y { get; }
  }
  </code></pre>
  
  <p>What could cause this error at runtime? I've tried explicity casting the yield return statement and returning a list (without yield) with no success</p>
  
  <p>EDIT: XValues and YValues are both List&lt; double ></p>
  
  <p>Calling code:</p>
  
  <pre><code>public IEnumerable Query()
      {
          yield return this.Data.XYPairsInRange(Double.NegativeInfinity, Double.PositiveInfinity);
      }
  </code></pre>