title: IEnumerable<T> in C#
body: <p>I am trying to get the following code to compile but am getting errors in VS2008.  Anyone can tell me where I am going wrong?</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace dummy
  {
      public class NaturalNumbersSequence : IEnumerable&lt;int&gt;
      {
          public IEnumerator&lt;int&gt; GetEnumerator()
          {
              for (int i = 1; i &lt;= 1000; i++)
                  yield return i;
          }
  
          IEnumerator IEnumerable.GetEnumerator()
          {
              for (int i = 1; i &lt;= 1000; i++)
                  yield return i;
          }
      }
  
      class Program
      {
          static void Main(string[] args)
          {
              foreach (int i in new NaturalNumbersSequence())
                  Console.WriteLine(i);
          }
      }
  }
  </code></pre>