I want to get this query at last:
select * from tableName where columnName & 2 = 2 and columnName & 4 = 4
How can I use LINQ to generate this script?
You can do bitwise operations in C# ( and in LINQ queries ) with either & or | depending on what bitwise operation you want.
var query =
from row in context.tableName
where (row.columnName & 2) == 2 && (row.columnName & 4) == 4
select row
context.tableName.ToList() instead, which would make it LINQ to Object instead of LINQ to EF / SQL.
==. See SQL WHERE caluse information here and the operator section: w3schools.com/sql/sql_where.aspselect * fromin LINQ. It'sfrom x in.*. Does SQL do bitwise-AND ?