My sample code block is as follows, I have a string array. This array consists of dynamically not predetermined
var query = _dbContext.Table..;
List<string> arr= ...;
// output: arr=X,Y,Z
foreach (var item in arr)
{
query = query.Where(f => f.XNumber.Contains(item))
}
The output of the expression I want to do should be like this
f.XNumber.Contains(item) or
f.XNumber.Contains(item) or
f.XNumber.Contains(item) or
but every where causes an and operator. How can I convert it to OR operator? Is there a method like WhereWithOr
?
Edit: my data looks like this:
XNumber:
12331X,
5113Y,
5123,
Z5123,
...
I'm trying to find items containing X or Y and Z in field XNumber