On Oct 15, 3:14*am, puzzlecracker <ironsel2...@gmail.comwrote:
"Any parameters passed to the method containing the yield block are
added as public fields to the generated enumerator class"
Why does compiler *adds these parameters as public fields?
please explain the need for that.
It was easier to implement the compiler that way. It allowed them to
reuse some other code (from anonymous methods, I believe). Yes, it
would be a bit cleaner to pass the values into a constructor for the
generator class, but as this is all generated code which can't be
referred to at compile-time, I'm willing to give them a bit of
leeway :)
Jon