title: LINQ: why does this query not work on an ArrayList?
body: <pre><code>public static  ArrayList   GetStudentAsArrayList()
  {
      ArrayList  students = new ArrayList
      {
          new Student() { RollNumber = 1,Name ="Alex " , Section = 1 ,HostelNumber=1 },
          new Student() { RollNumber = 2,Name ="Jonty " , Section = 2 ,HostelNumber=2 }
      };
      return students;
  }
  </code></pre>
  
  <p>The following code doesn't compile. The error is <code>ArrayList is not IEnumerable</code></p>
  
  <pre><code>ArrayList lstStudents = GetStudentAsArrayList();
  var res = from r in lstStudents select r;  
  </code></pre>
  
  <p>This compiles:</p>
  
  <pre><code>ArrayList lstStudents = GetStudentAsArrayList();
  var res = from  Student   r in lstStudents select r;
  </code></pre>
  
  <p>Can  anybody explain what the difference is between these two snippets? Why the second works?</p>