c# - Calling Console.WriteLine(ex.Message) to prevent warning message -
We usually hold exceptions to the upper level of code like GUI (form).
But I usually have this type of code
try {} catches {exceptions} {Console.WriteLine (ex.Message); MessageBox.Show ("The application has an error ..."); }
I could catch without the identifier (exception) because I do not need a message at runtime, but for debugging build, it is convenient to break into a catch statement. So I usually write a console to stop the warning of an unused pre-variable. There are lots of cases of my console Written in my code (e.g., this cost performance is low?
Note: The title has changed from "console." Is display cost of exemption (ex.message)? "Warning message" / P>
To stop "Calling Console.Publishing (Pre.
First
try {...} hold (exception) {}
Fully valid syntax is to connect to a console. Writite (ex.Message) just to talk The right thing to do is to get the compilation without any warning.
Second
The console WrightLine is not the proper way to diagnose, Look at the trace line or better still one. Of course the cost of the console. The lighting line, the cost is not very serious, still a call is made, and it costs
the third
Sometimes this is a better way of accident, it will help you to fix the problem of root Jbur does, at least one that is really bad.
>
Comments
Post a Comment