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

Challenge: Create custom string output - .NET Tutorial

From the course: .NET Essentials: LINQ for XML

Start my 1-month free trial

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