Any way to get Framework to return Line number of my code?

  • Thread starter Thread starter felecha
  • Start date Start date
F

felecha

I'm pretty new to .Net. I'm writing a Service and I have a number of
debug statements that go to a log, and I was thinking - it would be
wonderfully convenient if I could get the line number of my source
code into the log. I have done it "manually" with statements that
have the line number hard coded into them, but every time I change
the source above them, those line numbers are "out of date". Not a
real big problem, just something I'm curious about.
 
Hi,

if you compile with debug symbols, maybe you can use StackTrace and
StackFrame classes to get the information.

Sunny
 
Back
Top