c# - Return entities after intersecting with list of web controls using LINQ -


i can use following return ids (strings) match following intersect:

var ids = db.questionoption             .select(a => a.controlid)             .intersect(cs.select(b => b.clientid))             .tolist(); 

how intersect ids fetch entity, not matching id?

first can ids:

var idlist = cs.select(b => b.clientid); 

then can use contains this:

var result = db.questionoption.where(a => idlist.contains(a.controlid)).tolist(); 

or, can use join:

from q in db.questionoption join x in cs on q.controlid equals x.controlid select q 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -