See current method name in Micro Framework

223 Views Asked by At

How can I see the current method name in Micro Framework? I know of these two options, but they are for Windows Framework:

1.

MethodBase method = (new StackTrace(true)).GetFrame(0).GetMethod();
string methodname = method.DeclaringType.FullName + "." + method.Name;

2.

MethodBase method = MethodInfo.GetCurrentMethod();
string methodname = method.DeclaringType.FullName + "." + method.Name;

EDITED: There is another way, but neither works in Micro Framework:

3.

using System.Diagnostics;
// get call stack
StackTrace stackTrace = new StackTrace();
// get calling method name
Console.WriteLine(stackTrace.GetFrame(1).GetMethod().Name);
1

There are 1 best solutions below

0
On

You can try to do this using reflection...i know how to do using CSLA framework but i think this will not help you now.

This link may help you : http://msdn.microsoft.com/en-us/library/ms173183(v=vs.80).aspx

Good luck trying.