Getting error message in try catch (C#, Window Service) -
It is possible to get an error message in capturing the C # (or window service that was written with C #)
/ P>
string input = console Readline (); While (Input! = "Q") {try {double result = 10 / int.Parse (input); Console.light line ("+ input +" divided by "and result is" + result); } Hold (exception) {Console.WriteLine ("error, please try again"); } Finally {input = Console.ReadLine (); }} This was created for the ".exe" program. If I input characters ("A", "B", "C") or zero, then the program will show the message "Error, Please try again" so that I should know the error message. I do not want to edit the code. I need a tool to detect all the errors in the program.
Thank you for your help.
You want to print the message property of your own Replace hold with: hold (exception e) {Console.WriteLine ("An exception occurred:" + E. Message); }
Comments
Post a Comment