From the course: C#: Design Patterns Part 1

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Simultaneous iterators

Challenge: Simultaneous iterators - Python Tutorial

From the course: C#: Design Patterns Part 1

Start my 1-month free trial

Challenge: Simultaneous iterators

(upbeat music) - [Instructor] It's time for another challenge. Our new requirement is to add how many other orders that a customer has made and when. For each row that we want to display, we need to add the list of dates for previous orders by that customer. We'll need to iterate inside our views iterator to get the list of dates for previous orders. Now, we could combine a where clause and then select those items in link, but the goal is to practice using an iterator, and to do this in one step instead of two. Admittedly, this is a little contrived, and I probably would do this more simply in a real application. But the idea is to use the innumerable once within a single method you create that returns the items matching and expression. Add a new column to the view, previous orders. Display the list of dates for the previous orders for the same customer in that row. As a bonus, create it as a generic method for…

Contents