public void function_name() { int linenum = 0 ; try { somecodehere(); linenum++; someothercodehere(); linenum++; } catch(Exception ex) { Console.WriteLine("Line Number: " + linennum); } }
catch (Exception ex) { System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(ex, true); Console.WriteLine("Line: " + trace.GetFrame(0).GetFileLineNumber()); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)