Hello,
Here is what i want to do:
List<String> values = new List<string>();
values.Add("value1");
values.Add("value2");
values.Add("value3");
values.Add("value4");
values.Add("value5");
Expression<Func<Contacts, bool>> expr1;
if (values.Count == 1)
{
expr1 = (x => x.fonction.Contains(values[0]));
}
else if (values.Count == 2)
{
expr1 = (x => x.fonction.Contains(values[0]) || x.fonction.Contains(values[1]));
}
else if (values.Count == 3)
{
expr1 = (x => x.fonction.Contains(values[0]) || x.fonction.Contains(values[1]) || x.fonction.Contains(values[2]));
}
...
I have tried everything, i did not managed to make it in a loop...
Can you help me ?
Thanks