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.

Index into another sequence

Index into another sequence - .NET Tutorial

From the course: .NET Essentials: Working with LINQ

Index into another sequence

- Up to this point in the course, all of our queries have started with a single input sequence. And we've run a query and we've output our sequence, but we've always had just a single data source. In link you're not restricted to a single data source. There's multiple ways of combining sources. What we'll look at here in this video is one simple way of doing that. I have two sequences, one declared on line two, which is a list of int and one on lines four and five, which is a list of strings. You'll notice that I called the variable foods and my strings represent some food names, apple, banana cherry and so on. Now I have deliberately placed these in alphabetical order so as we start manipulating the data, it's easy to see when we switch around their positions in the output. Let's run the query. Right now I'm calling foods dot dump. And that shows that I have a list of string, there's 10 items. And we're seeing these in…

Contents