c# - Adding where clause to IEnumerable Select -


i have following line of code in controller selects id's of interests shown within view (they listed down page).

ienumerable<int> interestids = viewmodel.existinginterests.select(x => x.interestid); 

however want able add clause select section. in exisitinginterests there selected bool variable , want true.

this enable me add ones have been ticked database.

per discosultan in comments:

ienumerable<int> interestids = viewmodel.existinginterests.where(x => x.selected == true).select(x => x.interestid); 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -