How can I user reflection to get the fields inside a method? I tried to use the MethodInfo and then GetFields but the values returned are not the fields I defined within the method.
For example, using the code below, how would I get the FieldInfo for LineNo?
private void MyMethod()
{
int LineNo = 0;
}
Thanks
With reflection you can't get values of field in code of function,
You can get the values of field of Class/Object .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.