Is there any way to retrieve the current source filename and linenumber in C# code and print that value in the console output? Like LINE and FILE
This answer is outdated! See @taras' answer for more recent information.
No constant :(
What you can do is a lot uglier :
string currentFile = new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName();
int currentLine = new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileLineNumber();
Works only when PDB files are available.