This article is a mirror article of machine translation, please click here to jump to the original article.

View: 37483|Reply: 0

[Source] .net/c# exception to add additional information

[Copy link]
Posted on 2020-6-1 10:50:17 | | | |
When the program is abnormal, it is also necessary to record the parameters passed in by the current method, and the detailed exception log can be tracked more quickly for timely processing.

The sample code is as follows:

The main method calls the test program, the test program converts a string into an int type, the string obviously cannot be converted into an int type, so an exception will be thrown, we add additional information in the exception information, add the parameters passed into the current method, the effect is as follows:






Previous:Many resources are out of order
Next:.net/c# to get the current method name, parameter name
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com