How is it possible (maybe through Reflection or Roslyn APIs) to get the list of internal variables that are used in a class method?
For example, in the following code:
class C1{
private int var1;
public string var2;
void action1()
{
int var3;
var3=var1*var1;
var2="Completed";
}
}
I would like to get var3,var1 and var2 as the list(as name and type) of variables used in the action1() method.
Secondly, I need to identify which of the above variables appear on the left side of an expression; i.e., their values have been modified in this method.
I think the answer lies in using Roslyn, but I have no idea how. Thanks!
Aucun commentaire:
Enregistrer un commentaire