From the course: .NET Essentials: LINQ for XML
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Challenge: Create custom string output - .NET Tutorial
From the course: .NET Essentials: LINQ for XML
Challenge: Create custom string output
(upbeat music) - [Instructor] It's time for our first code challenge, where I pose a code problem, and you create your own solution to the problem. This is optional, but many of our learners like to see what they can create based on the lessons in a course. The intention of this challenge is to have you project the query data into a custom anonymous type. The data for your challenge is in this file, webColorsA.xml. Let's review the contents of that file. This file contains the root element web colors, and there are seven color elements within web-colors, your goal is to retrieve the information from these three child elements. The red, green, and blue values. The goal is to create a query expression that outputs a sequence, and then places the results into a custom type, an anonymous type. And you're going to show the color name, and then you'll also show the string, which represents an RGB color form there. So you'll…
Contents
-
-
-
-
-
(Locked)
Use Query syntax to work with elements2m 46s
-
(Locked)
Attribute query1m 27s
-
(Locked)
Select data into a new anonymous type1m 47s
-
(Locked)
Where clause on attribute value1m 53s
-
(Locked)
Where clause with compare2m 11s
-
(Locked)
Aggregate queries2m 1s
-
(Locked)
Choose output order with OrderBy42s
-
(Locked)
Query for empty elements and blank values3m 21s
-
(Locked)
Group by3m 26s
-
(Locked)
Challenge: Create custom string output1m 46s
-
(Locked)
Solution: Create custom string output1m 14s
-
(Locked)
Challenge: Filter results to show elements with no content47s
-
(Locked)
Solution: Filter results to show elements with no content55s
-
(Locked)
Challenge: Filter results to show invalid values1m 39s
-
(Locked)
Solution: Filter results to show invalid values1m 53s
-
(Locked)
-
-