Drew,

Thanks, this looks like exactly what I need. It's for last ditch error
handling, so performance isn't really an issue.

Thanks,
Erick

----- Original Message -----
From: "Marsh, Drew" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 25, 2002 3:29 PM
Subject: Re: [DOTNET] Method call in parameter?


> Erick Thompson [mailto:[EMAIL PROTECTED]] wrote:
>
> > Thanks for the snippet. I was looking for something generic
> > (for stock error logging code), so I could paste it in, but
> > haven't had any luck so far. If it comes down it, I guess I
> > could get the stack from the exception and walk back up it to
> > find the name of my method that caused the error, but that
> > doesn't sound appealling to me.
>
> Ahh... yeah. Well if you were an add-in generating code via VS.NET you
could
> obviously use the CodeModel to determine the current class and generate
the
> statement like that. As far as cut and paste though...? Yeah I guess you'd
> have to use something like:
>
> <codeSnippet language="C#">
> MethodBase.GetCurrentMethod().DeclaringType.Name
> </codeSnippet>
>
> Which if you're only using in exceptional cases for error reporting, the
> overhead doesn't really matter.
>
> HTH,
> Drew
>
> You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to