From the course: LINQPad Essential Training

Side by side output

- [Instructor] By defaults, the results are shown in a vertical list. Using a side-by-side view is beneficial when comparing data. We can switch to side by side with the Util.HorizontalRun method. So let's take a look at the default output. See, I have two tables with four rows and they're one above the other. And I'd like to have the second table be on the right side of the first table now to do that I need to, we should probably examine the code first. So what I'm doing here is I got a query at the top, that's getting some of my colors and I'm also just extracting the color name and the blue percentage value. And I'm also formatting the results. It's stored as a double in the data source. And here I am converting it to a string that shows a percentage. And that's what we're seeing here color name and blue percent. And then I'm using the Take method to take the first four results in the GetColors method. And then in the second item, I'm skipping the first 20 and then taking four. So this allows me using link to get a subset of the data that's in the original data. And then I'm dumping out the first batch and the next batch. That's what you're seeing here. So to change this to a side-by-side mode I'm going to Util.HorizontalRun. And this expects a Boolean parameter of how much gap to have between the two tables and then a parameter array of the items to show. So I have two items first batch and second batch. So I'll say with, I shouldn't I should say true with gaps, and then I will use firstBatch, nextBatch and they'll have to dump the results that looks good, now rerun. And I should also comment these two lines of code. So you can see it. I don't always have to scroll down the page and there's the two tables side by side. And notice there is a small gap between the two tables. If I set this to false, it'll be even smaller. So that's how to use the HorizontalRun to do side-by-side data.

Contents