List<String> NewList = null;
List<String> student = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
List<String> staff = { 5, 26, 8, 20, 34, 15 };
foreach (String mbr in student ) {
if(staff.Contains(mbr) {
NewList.Add(mbr);
}
}
In this NewList has the values 5,8,15 from Student List.
List<String> student = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
List<String> staff = { 5, 26, 8, 20, 34, 15 };
foreach (String mbr in student ) {
if(staff.Contains(mbr) {
NewList.Add(mbr);
}
}
In this NewList has the values 5,8,15 from Student List.