filtering one list based on another list c# -


this question has answer here:

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

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -