W
wsq
in C++ we can use __FILE__ and __LINE__ to help us locating the bug, is
there anything like these in C# ?
thanks,
wsq
there anything like these in C# ?
thanks,
wsq
Unfortunatelly .NET have no similiar macros.
To get this functionality u have to use StackTrace class
Smth like this
using System; using System.Diagnostics ;
namespace getline { class Class1 {
[STAThread] static void Main(string[] args)
{ StackTrace st=new StackTrace
(0,true);
StackFrame sf=new StackFrame ();
sf=st.GetFrame (0);
Console.WriteLine ("FileName: {0}",sf.GetFileName ());
Console.WriteLine ("Line Number:
{0}",sf.GetFileLineNumber ());
Console.WriteLine ("Function Name: {0}",sf.GetMethod ());
Console.Read (); } }
}
w> in C++ we can use __FILE__ and __LINE__ to help us locating the bug,
w> is there anything like these in C# ?
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche