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

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -