First example which works:
public class Test
{
public int ID;
public string Name;
}
List<int> list1 = Load1();
List<Test> list2 = Load2();
var query = list2.Where(c => list1.Contains(c.ID));
Now I would like to use two lists of objects as a source and get list of objects that have this same values for member ID.
List<Test> list1 = Load2();
List<Test> list2 = Load2();
Below doesn’t compile:
var query = list2.Where(c => **list1.ID.Contains**(c.ID));
I know it is wrong but placed it here for better understanding.
I would appreciate someone to show me the right path 🙂
Regards
Mariusz
You could make your Test class equatable:
Then this would work: