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 - .NET Tutorial
From the course: .NET Essentials: Working with LINQ
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
-
-
-
-
-
-
-
-
-
-
-
The GroupBy method2m 27s
-
(Locked)
GroupBy query expression1m 53s
-
(Locked)
GroupBy with ElementSelector2m 36s
-
(Locked)
GroupBy with ResultSelector2m 29s
-
(Locked)
Iterate over groups1m 44s
-
(Locked)
Combine two sequences3m 47s
-
(Locked)
Flatten sequence with SelectMany2m 15s
-
(Locked)
Challenge: Group results by color values2m 30s
-
(Locked)
Solution: Group results by color values1m 35s
-
-
-
-
-
-
-