I have an array of structs (aryShooters()). I need to determine which post they are in and if they are active. If they are then I want to store which index they were at. If the post wasn't filled then the index to that spot in the array is set to -1. The problem I am having is that in my query where I check it then use AndAlso, isn't short-circuiting the rest of the line.

Why do you use bitwise operators here at all?
–
MagnusJan 26 '12 at 20:41

@Magnus, How else would you suggest selecting in a query with lots of criteria as efficiently as possible? Wouldn't running the criteria through a huge if statement in the for each loop be less efficient than running it through the Linq/Sql which is meant for sorting through the table?
–
Michael StramelJan 27 '12 at 14:08

Are you sure you shouldn't be using AndAlso and OrElse everywhere here?
–
MagnusJan 27 '12 at 14:57

Fairly, Positive. On all the other parts of the query, I don't care if it evaluates to false and continues. In some cases I HAVE to have it continue the expression no matter what. Also, that would give me the same issues, I am assuming as the current AndAlso gives. With the current AndAlso , it checks the index to see if it is greater than -1 which it will be if it isn't -1 and should terminate that and IFF the variable equals -1.
–
Michael StramelJan 28 '12 at 2:47

1

Linq2Sql does not process it differently. Linq2Objects does
–
MagnusJan 29 '12 at 14:03

There are lots of parentheses that seemed to be not used but are actually being used to group the and's & or's. The last "if" statement after the and is if all of those return true then it and's it with True. I don't have my other queries in from of me but they should all resemble the same way my original code posted above is. I will check to make sure that they do resemble other queries. But the code worked before when I wasn't using the AndAlso in my code and a different referencing method. This previous method was incorporated into the new array of structs.
–
Michael StramelJan 27 '12 at 14:01

Also the syntax that was posted in original context is correct as far as similar to other queries that work.
–
Michael StramelJan 27 '12 at 14:18