The odd way this is done is actually necessary. On :226, item is captured in lambda's closure, to be evaluated sometime later. Foreach desugars to a loop that repeatedly assigns to the same variable, rather than creating a new binding each iteration. [I believe this is fixed in C#5 or so?]

However, it looks like we could just pull the text out of the item eagerly near :226, and then do what you suggest.