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.
Combine two sequences - .NET Tutorial
From the course: .NET Essentials: Working with LINQ
Combine two sequences
- [Instructor] I think all of the examples we've looked at so far in this course have worked with a single input sequence. And real world applications. You're going to have multiple sequences that you're using in your code. And there will be times when you want to combine those sequences in some way. Now, one way to do that is the way we do in databases, where we have multiple tables. We do what's called a joint. Link does have a join extension method. I'm not looking at that in this course, but it is available. Instead I thought I would just take a look at using groups and select to take two input sequences and I put some sort of combination. So we should probably start by looking at my sets of data. The first set is to find in line three, this has a numbers, two, three, and four. Set B has the numbers five, six, and seven. Next I'll write a query expression. One of the rules of query expressions is they have to end…
Contents
-
-
-
-
-
-
-
-
-
-
-
The GroupBy method2m 27s
-
GroupBy query expression1m 53s
-
GroupBy with ElementSelector2m 36s
-
GroupBy with ResultSelector2m 29s
-
Iterate over groups1m 44s
-
Combine two sequences3m 47s
-
Flatten sequence with SelectMany2m 15s
-
Challenge: Group results by color values2m 30s
-
Solution: Group results by color values1m 35s
-
-
-
-
-
-
-