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;
}
다음 코드는 컴파일되지 않습니다.LINQ :이 쿼리가 ArrayList에서 작동하지 않는 이유는 무엇입니까?
ArrayList lstStudents = GetStudentAsArrayList();
var res = from Student r in lstStudents select r;
는 사람이 차이가 두 조각 사이에 무엇인지 설명 할 수 : 오류이 컴파일 ArrayList is not IEnumerable
ArrayList lstStudents = GetStudentAsArrayList();
var res = from r in lstStudents select r;
입니까? 왜 두 번째 작품?
뭔가, 두 번째 (작업) 버전은 내부적으로 lstStudents.Cast()를 선택 R에서 R에서 같은 VAR 입술 =을 구현; 이 질문에 대답하지 않기 때문에 –