How to get fields in method using Reflection

  • Thread starter Thread starter djp
  • Start date Start date
D

djp

Hi,

I'm trying to access fields that are local to a method using reflection.
What BindingFlags value should I use and is this possible at all. So far I
was able to retreive class fields only.

Thanks
 
I don't think that is possible. You can get fields of a class, but not fields local to a method

Tu-Thac

----- djp wrote: ----

Hi

I'm trying to access fields that are local to a method using reflection
What BindingFlags value should I use and is this possible at all. So far
was able to retreive class fields only

Thank
 
Unfortunately that's not possible with current releases of the framework. "Fields" in a method aren't really fields at all, but rather just space
reserved on the stack for local variables. You need to access the IL of the method in question to find these.

-Shawn
http://blogs.msdn.com/shawnfa

--

This posting is provided "AS IS" with no warranties, and confers no rights.
Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they
originated.
--------------------
 
Back
Top