I came up with a contrived example for the sake of illustration, and deliberately chose to use LINQ to build the enumerable because of how valuable it can be in filtering and ordering data. Where and TakeWhile alone can replace a whole lot of continues and breaks.
Your code does the same job as my first example, and it’s simpler, and maybe that’s more appropriate for the class.
My brain goblins love refactoring. I love taking a rusty pile of shit and making it shine. I want to polish something old, or build something completely new. Adding features to existing code is the part I hate.