Use the StackFrame class in the System.Diagnostics namespace, like so:
// Get the current stack frame.
StackFrame stackFrame = new StackFrame();
// Write the method name:
Console.WriteLine(stackFrame.GetMethod().Name);
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
<vc*******@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
How to obtain a function name during the execution code?
For example:
public void Acme()
{
try
{
some code goes here
}
catch(Exception ex)
{
MessageBox.Show("Oops, an error occured at " + <here goes
'Acme'>, "Title",...);
}
}
Thanks in advance!