From the course: .NET Essentials: Working with LINQ

Unlock this course with a free trial

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

Challenge: Filter results with Where

Challenge: Filter results with Where - .NET Tutorial

From the course: .NET Essentials: Working with LINQ

Challenge: Filter results with Where

(upbeat music) - [Instructor] It's time for another Code Challenge. This time, I'd like you to write a link query that filters the information using the where clause. So here's the scenario. When you call GetColors() on my ColorSource, you get back a list of web color. And we found that there are some problems with the values that are in the ColorName property and the values that are in HexValue. So I want you to write a query to find these problems. So write a query expression that finds the ColorName values that contains hyphens. I want you to find the HexValues that are not valid hexadecimal values. In hex, you can have values from zero to nine and the letters A, B, C, D, E, and F. So on line nine, I've got an example of a valid HexValue, FFFF00. Line 10 has an invalid example because of the letter T in that hexadecimal number. I'd like you to write these two tests using where clauses, and I want you to combine those…

Contents