I would like to print out my debug message with line number in VB.net application. I did like this,
Dim st As StackTrace
Dim sf As StackFramee
st = New StackTrac
After reading the several answers I came for me to the following solution as equivalent to the C++ macro LINE
(New StackTrace(New StackFrame(True))).GetFrame(0).GetFileLineNumber())
which can be used for example as:
Console.WriteLine(String.Format("Executed on line# {0}", (New StackTrace(New StackFrame(True))).GetFrame(0).GetFileLineNumber()))