有一堂课
Public class Student
{
int id;
int rollNum;
String Name;
}
一个方法
Public List<Student> GetAllStudents()
{
var studentList = GetMeAll(); // Simple select * query to get all students
//unfortunately i can't make changes in this method so have to write a linq query to //filter data.
//getting int array ids correctly from some method
var filterList = FilterStudentsByID(ids,StudentList);
}
我想编写一个将 int 数组作为输入并返回 List 的方法
Public List<Student> FilterStudentsByID(int[] ids,List<student> studentList)
{
//There should be a linq query , but I am new to linq so don't know how to write this.
Var list = from studentList in ..... don't know much;
}
编写查询的任何帮助。谢谢大家的回答,我也在寻找保持大量记录的表演??如果您可以添加我对查询的简单解释将在内部工作,那就太好了?