class Student { public string Name { get; set; } public int Age { get; set; } public Student(string name, int age) { Name = name; Age = age; } } List
students = new List
(); students.Add(new Student("Ogre", 19)); students.Add(new Student("Skeleton", 20)); students.Add(new Student("Giant Bat", 17)); students.Add(new Student("Slime", 23)); 查询students中年满18岁的Student对象,且按Age升序排序,写法正确的是? A. var query = from s in students where s.Age > 18 orderby s.Age select s; B. var query = students.Where(s => s.Age > 18).OrderBy(s => s.Age); C. var query = students.Where(delegate(Student s) { return s.Age > 18; }).ToList(); query.Sort( delegate(Student s1, Student s2) { return s1.Age - s2.Age; }); D. List query = new List (); students.ForEach(delegate(Student s) { if (s.Age > 18) query.Add(s); }); query.Sort(delegate(Student s1, Student s2) { return s1.Age - s2.Age; });