LINQ and looping

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

I have a SQL/Server table with a big int field that represents individual
bit settngs. I'd like to use LINQ to iterate through that table, and
bit-wise OR the contents of that field. It could be done, I know, by first
retrieving the records, and then doing the ORing in a subsequent ForEach
loop, but can it be done in a single LINQ query?
If so, could you give me some idea of what that code would look like?
Thanks,
Ben


(e-mail address removed)
 
Ben said:
I have a SQL/Server table with a big int field that represents
individual bit settngs. I'd like to use LINQ to iterate through that
table, and bit-wise OR the contents of that field. It could be done, I
know, by first retrieving the records, and then doing the ORing in a
subsequent ForEach loop, but can it be done in a single LINQ query?
If so, could you give me some idea of what that code would look like?

I don't know of any SQL construct which would offer that kind of
functionality. Other than that, you really have to specify which linq
provider you're using to produce the queries as linq constructs aren't
converted to DB queries out of the box.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
Back
Top