I have the following problem. I want to get the name of the method that is calling a method, that is calling the method where I want to access the value of the first method.
For an example:
public void functionTOPLevel()
{
functionSECONDLEVEL();
}
public void functionSECONDLEVEL()
{
functionACCESSTOPLEVELNAME();
}
No I've tried to access it via the StackFrame like this:
public void functionACCESSTOPLEVELNAME()
{
StackFrame frame = new StackFrame();
string name = frame.GetMethod().Name;
}
Here the value of name
is functionSECONDLEVEL
, as expected. Is there a way to access the name of the function functionTOPLevel()
?
Aucun commentaire:
Enregistrer un commentaire