I encountered this LINQ statement, which after some exhaustive Googling, I haven't found a comprehensive explanation:
var x = Context.TableName
.AsNoTracking()
.Where(x => (x.ColumnName & 2) == 2)
.Select(x => new {col = x.Column})
.ToList();
The part that I don't completely get is the .Where
clause here.
.Where(x => (x.ColumnName & 2) == 2)
I am unsure whether that value resolves to an 'AND'
clause?
Additional info: Found out that the & means the Bitwise AND operator. But how is it being applied to the value in place? For example, if the Column value is 514, it is being retrieved, but if it is 512, it is not being retrieved. I just want to understand how the bitwise is checking its applicability in the said values (514, 512).
Edit: Typo on 3 on the bitwise. Should be 2!