I’m interested in retrieving the names of local variables (and parameters) at run-time in a refactor-safe manner. I have the following extension method:
publ
This is a behavior you should not rely upon.
Take a look at Abuse of C# lambda expressions or Syntax brilliance?
Now read the comments from Eric Lippert who is on the C# design team. They include:
I just asked Anders (and the rest of the design team) what they thought. Let's just say the results would not be printable in a family-friendly newspaper
and
As for why this is horrid, we could start with unobvious, clever (remember, clever is bad, clever code is hard to maintain), not at all within the by-design use cases envisaged by the designers of lambdas, slow, brittle, unportable, and unnecessary
From these statements I would say that it will not become a documented or supported behavior.