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.

Learn how to use expressions with select

Learn how to use expressions with select - .NET Tutorial

From the course: .NET Essentials: Working with LINQ

Learn how to use expressions with select

- In the last video, I created an anonymous type, and I pulled some data out of the original web color class. And, assigned those to some properties in the anonymous type. And that's a common scenario that you see when you're doing words with LINQ. But remember that you can use any expressions to assign those values to the properties. And that means we're not limited to just pulling data straight out of a type like I did in the previous example. I can do math formulas, I can do concatenation operations. Really, any code that you can run can be placed in the LINQ query, in the select clause. So, that's what I thought I would look at here. Some of the types of operations we can perform with the select. So then scenario is I've got some numbers here using enumerable range to generate those. And then I'm selecting on a new anonymous type here and I have a property called OriginalNumber and I'm assigning the original value.…

Contents