How do we get the Line number of the currently executing code in C#/WinForms.
In PHP we can do __LINE__
or __FUNCTION__
to access details about the currently executing piece of code.
How do we get the Line number of the currently executing code in C#/WinForms.
In PHP we can do __LINE__
or __FUNCTION__
to access details about the currently executing piece of code.
check this class and example StackFrame
StackFrame sf = st.GetFrame(i);
Console.WriteLine(" File: {0}", sf.GetFileName());
Console.WriteLine(" Line Number: {0}", sf.GetFileLineNumber());
Console.WriteLine(" Column Number: {0}", sf.GetFileColumnNumber());