Accepted answer

linq is designed for querying. if you're trying to set things, you should definitely use a loop (probably foreach). that doesn't mean you won't be able to use linq as part of that loop, but you shouldn't be trying to apply a side-effect within linq itself.


query the otheritems first. do a todictionary() on the result. then, when querying the database, do this:

var items = from i in context
   select new myclass 
   { a = i.a, 
     b = otheritems[i.a], 
     c = i.c

Related Query

More Query from same tag