class Student
{
public int id { get; set; }
public string name {get;set;}
}
List<Student> students = new List<Student>() {
new Student (){ id =9, name ="n9"} ,
new Student (){ id =1, name ="n1"},
new Student (){ id =2, name ="n2"},
new Student (){ id =3, name ="n3"},
new Student (){ id =4, name ="n4"},
new Student (){ id =5, name ="n5"},
new Student (){ id =6, name ="n6"},
new Student (){ id =7, name ="n7"},
new Student (){ id =8, name ="n8"},
};
List<int> ids = new List<int>() { 8, 2, 3, 4 };
var query1 = students.Where(x => ids.Any(y => x.id == y));
foreach (Student r in query1)
{
int id = r.id;
}
datagrid_students.ItemsSource = query.ToList<Student>();
List<studern> listStuder=(from student in students where student.id.Contains(student.id)).toList<Student>();
List<studern> listStuder=new List<studern>();
for(int i=0;i<id_list.count;i++)
{
List<studern> listStu=(from student in students where student.id.Contains(student.id)).toList<Student>();
for(int j=0;j<listStu.count;i++)
{
listStuder.add(listStu[j]);
}
}