I have a comma-separated list of record Ids that I get from a query string. I need to return all the records (from a SQL Server database) with those Ids. What’s the best way to do that in Linq?
I figure that it will ultimately be transformed into a SQL statement of the form “WHERE id IN (1,2,3,…)”, and since that query contains the same comma-separated list that I’m starting with, it seems a shame to un-pack it into an int array and then let Linq convert it back again. But if that’s the only way, then fine.
As you hinted at, it’s easiest to convert it to an array first.