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.

Iterate over groups

Iterate over groups

- [Instructor] We've been using LINQPad for most of the examples in this course. LINQPad has this Dump extension method, which has a great job of iterating through our query and formatting the results so they look nice when they get placed in the output window. In fact, we've seen many times that it creates a table of information with rows and columns. So it's a really nice view of the data, but of course, in our real-world applications, we probably won't have that feature. So we'll be using things like for-each loops to walk through that query. In this chapter, we're working with groups and groups have nested sequences. So I thought I would spend a few minutes talking about how you would look through or iterate through the data in a group. Now remember that each group has a set of values that belong to that group. So there's really two levels of sequences. So that means we need to have at least two for each loops in…

Contents