No, there is no way around that.
It's a feature that's been requested, and it's not a bad idea (a yield foreach
or equivalent exists in other languages).
At this point Microsoft simply hasn't allocated the time and money to implement it. They may or may not implement it in the future; I would guess (with no factual basis) that it's somewhere on the to do list; it's simply a question of if/when it gets high enough on that list to actually get implemented.
The only possible change that I could see would be to refactor out all of the individual yield returns
from the top of the method into their own enumerable returning method, and then add a new method that returns the concatenation of that method and methodReturningEnumerable(x,y,z)
. Would it be better; no, probably not. The Concat
would add back in just as much as you would have saved, if not more.