From the course: Complete Guide to .NET LINQ: Querying Collections, Databases, and Markup

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Solution: Filter elements with no content

Solution: Filter elements with no content

(lively music) - [Instructor] This is my solution. I started off by getting all the colors and then I checked for, I used the String.IsNullOrEmpty and I said look at this color element, check its value and see if it's null or empty. And you can see that it returns two items. So this has a hue value of nothing. And so does the second color. However, you notice that the saturation is empty for this one, but not for the second one. So when I uncomment this line, I use a slightly different syntax, this time I said color.element("Saturation").Value equal equal empty string. When I run this query I get back a single color element.

Contents