From the course: LINQPad Essential Training

Unlock this course with a free trial

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

Exclude and include columns

Exclude and include columns - LINQ Tutorial

From the course: LINQPad Essential Training

Exclude and include columns

- By default, when we dump a complex object, the result are formatted in a large table. In this example, on line three through five, we're working with my web colors collection. When I run this, I get an HTML table that has six rows and ten columns. Since this is written as a LINQ expression, we could filter the results and limit the columns by changing the LINQ query. Let me show you another technique for adding and removing columns that doesn't require changing the LINQ query. It's the include and exclude dump parameters. What I'll do is, I'll add an extra parameter to the dump method. It's the exclude parameter and it takes a comma to limit the list of items in a string. So right now, there's only one item. This will remove the HSL column. So keep your eye over here. Rerun the query. Now that column is no longer in the outputs. It's still in the data, it's not being shown in the results panel. Next, let's remove the…

Contents