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.