From the course: .NET Essentials: Working with LINQ

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Learn how to use logical operators with the Where method

Learn how to use logical operators with the Where method - .NET Tutorial

From the course: .NET Essentials: Working with LINQ

Learn how to use logical operators with the Where method

- [Tutor] The WHERE clause expects any valid Boolean expression. And that means that you can use the logical operators as part of that Boolean expression. So that's what we'll look at in this example, we'll be looking at the AND operators, the OR operators. We won't look at the Mod operator or the XR operator, but those are also allowable. So let's start by looking at my first example. I have a WHERE clause here, the first part of the WHERE clause is to filter to the ColorFamily.Orange. And then I'm adding that together with color, ColorName, contains, and I'm looking for an empty string. If they meet both these criteria included in the output sequence. I want to run this I get back six items since nothing's changed yet, but now let's go in here and add a search for a letter. I'll look for the lowercase letter O, now I get back three items, tomato, coral and gold. If I switched this to an uppercase O, then I get back…

Contents