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
From the course: Complete Guide to .NET LINQ: Querying Collections, Databases, and Markup
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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Use Query syntax to work with elements4m 59s
-
(Locked)
Query element values in XML1m 10s
-
(Locked)
Query attributes in XML1m 56s
-
(Locked)
Project data into an anonymous type4m 10s
-
(Locked)
Filter by attribute value with Where1m 52s
-
(Locked)
Use Where to compare values2m 10s
-
(Locked)
Perform aggregate queries in XML1m 26s
-
(Locked)
Sort query results with OrderBy3m 29s
-
(Locked)
Find empty elements and blank values4m 51s
-
(Locked)
Group XML data with GroupBy3m 48s
-
(Locked)
Challenge: Create a custom string output1m 50s
-
(Locked)
Solution: Create a custom string output1m 19s
-
(Locked)
Challenge: Filter elements with no content52s
-
(Locked)
Solution: Filter elements with no content51s
-
(Locked)
Challenge: Filter results for invalid values1m 28s
-
(Locked)
Solution: Filter results for invalid values1m 54s
-
(Locked)
-
-