I have hundreds of events/functions in my windows app. now they look
like this

private void muHowlNow_Click(object sender, EventArgs e)
{
Debug.WriteLine("HowlNow was clicked");
this.Label1.Text = "wow";
//do some stuff
}
I am tired of having to put Debug.WriteLine("HowlNow was clicked");
every time. Is there a way (through reflection or some other magic) to
have it Debug.Writeline the function name automatically?

This will make life easier, and also when I obfuscate my code later it
will make it more difficult for a cracker to understand.

Re: way to automatically Debug.Writeline every function/event thru reflection? by Lloyd

Lloyd
Sat May 21 23:35:59 CDT 2005

what about something like (untested pseudo-code)

private void muHowlNow_Click(object sender, EventArgs e)
{
PrintCurrent();
this.Label1.Text = "wow";
//do some stuff
}
[Conditional("DEBUG")]
void PrintCurrent()
{
Console.WriteLine(System.Diagnostics.StackTrace.GetFrame(-1));
}
<thomasamillergoogle@yahoo.com> wrote in message
news:1116720534.931415.219640@g14g2000cwa.googlegroups.com...
>I have hundreds of events/functions in my windows app. now they look
> like this
>
> private void muHowlNow_Click(object sender, EventArgs e)
> {
> Debug.WriteLine("HowlNow was clicked");
> this.Label1.Text = "wow";
> //do some stuff
> }
> I am tired of having to put Debug.WriteLine("HowlNow was clicked");
> every time. Is there a way (through reflection or some other magic) to
> have it Debug.Writeline the function name automatically?
>
> This will make life easier, and also when I obfuscate my code later it
> will make it more difficult for a cracker to understand.
>