filtering one list based on another list c# -
this question has answer here:
- filter list list c# 4 answers
i have 2 lists.
the first list list of members memberkey identifies member.
the second list list memberkeys
;
i want filter member list memberkeys in list of memberkeys.
list<member> memberslist = getmembers(); list<int> memberkeys = // list of member keys find list<member> members = memberlist.where(x => x.memberkey ????? // in memberkeys list
quite simple way:
list<member> members = memberlist.where(x => memberkeys.contains(x.memberkey)).tolist();
Comments
Post a Comment