Reputation: 13
Given this answer: https://stackoverflow.com/a/4263048
Which is excellent, how can we be sure that out query won't get into an infinite recursion?
With the example class provided, if the boxes point to one another and the answer doesn't exist, would it search forever? Or is that part of the Linq "execution plan", for lack of the actual word?
Upvotes: 1
Views: 210
Reputation: 496
No, it returns itself at the first yield return, and only recursives if the contents of the box are not empty; so when you get an empty box the recursion unfolds.
The FindBoxBySize looks to match on size (from found items) or default.
Upvotes: 3