I'd never seen that was a property, thanks.

John Warner




> -----Original Message-----
> From: Discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED] On Behalf Of Brady Kelly
> Sent: Friday, August 01, 2008 9:17 AM
> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> Subject: Re: [ADVANCED-DOTNET] Find the line number of an exception.
>
>
> > Likely a function of the fact .NET supports any number of
> languages.
> > What constitutes a line?
> >
> > John Warner
>
> It's actually quite easy, in C# at least:
>
>         private static void ShowDebugInfo(Exception ex)
>         {
>             StackTrace exTrace = new StackTrace(ex, true);
>             Console.WriteLine(exTrace.GetFrame(0).GetMethod().Name);
>
> Console.WriteLine(exTrace.GetFrame(0).GetFileLineNumber().ToString());
>         }
>
> ===================================
> This list is hosted by DevelopMentorR  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to