From the course: .NET Essentials: Working with LINQ

Unlock this course with a free trial

Join today to access over 22,500 courses taught by industry experts.

Select into anonymous type

Select into anonymous type - .NET Tutorial

From the course: .NET Essentials: Working with LINQ

Select into anonymous type

- [Instructor] When you work with a relational database and you query a table, you might be working with a table with lots of rows, thousands or millions of rows of data, and that table might also have multiple columns, many columns. I've seen tables with 250 columns. Now, when you write the query in SQL, you can specify the number of rows that you want to return, but you can also specify the number of columns that you want to return. Maybe I only want to see two columns. What we're going to look at in this video is how to do something similar with Link Select. The problem starts here, so I've got this Web Color Class and it has 10 properties. I'm only interested for a query I'm writing in the color name and the hex value. But it doesn't matter. If I query and I return a innumerable of Web Color, I'm going to get all 10 properties populated, with the information from the dataset. And of course, that means two things.…

Contents