linq-to-sql fails if local list variable -


i'm struggling thought simple linq-to-sql query work. can construct query ok , can verify sql generates correct when executing dreaded "system.notsupportedexception: queries local collections not supported" exception.

i've simplified query in short query below works:

var query = asset in context new[] { 1, 2, 3 }.contains(asset.code) select asset 

this query works:

var query = asset in context new list<int>() { 1, 2, 3 }.contains(asset.code) select asset 

but query below fail when attempt made result set:

list<int> mylist = new list<int>(){1, 2, 3}; var query = asset in context mylist.contains(asset.code) select asset 

anyone solved sort of issue?

what posted should work, leading me believe didn't post broken code.

make sure mylist variable list<int> , not ilist<int>... if variable type ilist<int>, you'd exception.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -