I 'm using c# to select some objects in a List. The following code is working.
public void filterByWork(string work, int precision)
{
workResults = new List<FbUser>();
Array keywords = work.Split(' ');
workResults = userlist.Where(user => user.work != null);
workResults = workResults.Where((user => user.work.Any(wrk => StringExtensions.match(wrk.employer.name, keywords) >= precision)));
}
But what if i want more than one condition? Can i use the 'OR' keyword somewhere? Because i want to select all objects where the wrk.employer.name = "something" OR wrk.position.name = "something". How can do this?
Thanks in advance!
You can simply use the normal || operator:
workResults = workResults.Where((user =>
user.work.Any(wrk => wrk.employer.name == "something" ||
wrk.position.name == "something")
));
Well, you could just use C#s or operator (||).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With