how to get current line number ?

Hi,

is there any way to obtain current line number in C#. looks like a __LINE__ in C++..

thanks.



Answer this question

how to get current line number ?

  • shax

    No there is not. Can you explain what you want it for and perhaps someone can provide an alternative solution Presumably you want to be able to generate a message containing the current line #. This is not really doable other than through a call stack trace (which can't be done in C++). The call stack trace will give you all the information you'll need like the filename, method name and line #). However this information is dependent upon having the PDB file available.

    Michael Taylor - 11/10/06


  • how to get current line number ?