Linq Dynamic Query Issue - Operator 'OR' incompatible with operand types 'Boolean' and 'String'

c# dynamic-linq linq

Question

I am currently trying to define a dynamic query in Linq but I am receiving the following error: enter image description here

My Query is the following:

valuesList = valuesList.Where("(position=1 OR value LIKE '%3%')")

What am I doing wrong?

1
0
6/16/2017 7:39:49 PM

Accepted Answer

Try this-
You cannot pass string inside a linq statement

 valuesList = valuesList.Where(x=>x.position == 1 || x.value.Contains(3))
0
6/16/2017 7:43:58 PM


Related Questions





Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow