Get Calling Action or Timer

Get Calling Action or Timer

  
Is it possible to get information of the Calling action name  or in which Timer my action is running?

something like this in C#

http://www.csharp-examples.net/reflection-calling-method-name/

Kind regards,
Matthias
Hi Mathias,

I did a quick test and its indeed possible. You could crerate an extension with an action that returns the method name.
I've done a sample that returns the entire stack (separated with new lines)

 public void MssGetMethodName(out string ssMethodName) {

        StackTrace stackTrace = new StackTrace();

   ssMethodName = "";

   for (int i = 0; i < stackTrace.FrameCount; i++)

   {

         ssMethodName += string.Format("{0} : {1} : {2}", i,                                                    stackTrace.GetFrame(i).GetMethod().Name, Environment.NewLine);

          }

} // MssGetMethodName

and this was the output



I also tested inside a timer and the name of the action came on index 3 so I would say for you to see which one fits your goal.

Hope this helps.

Cheers,
LGP