mardi 1 septembre 2020

C# Reflection, Parsing a return statement

I wanted to see if there is a way to retrieve return statement of a method from somewhere else. If I have a method as following,

public int SomeMethod(){
    // Something happened here
    return a + b + c; // assume these variables were initiated above
}

Is there a possible way for me to get a list of string { "a", "b", "c" }?

I looked into Reflection's MethodInfo, but it only tells the "a+b+c" as a whole. Worst case, I might have to find which file contains that method and parse the return statement manually. I was curious if there was an already-built tool out there.





Aucun commentaire:

Enregistrer un commentaire