Does Try-catch really affect program performance?
Today and TL debate try-catch use of the problem, whether for the code to look beautiful and put all the code under the Try-catch, I take it for granted, but not in-depth research on the
Will Try-Catch really affect program performance?Today, I argue with TL about try-catch usage. Do you want to put all the code in this method into try-catch to make the Code look beautiful? I naturally disagree with it, however, I have not studied
Try { MessageBox.Show ("true");} Catch { MessageBox.Show ("false");} finally { MessageBox.Show ("finally");}NotesThrow exception with throw new exception, catch exception with try: Catch.. Finally
The
Try ... catch is intended to
Many posts have analyzed the Try-Catch mechanism and its impact on performance.
However, there is no evidence that Try-Catch consumes too much of the system's performance, especially in a hosted environment. I remember a netizen in the garden
Ever since we started thinking about the efficiency and performance of code, there's more and more things to write about, like when should I add Try/catch? Will adding too many try/catch reduce performance? Share Some ideas about the impact of
Since considering the code running efficiency and performance, there are more and more considerations for writing code. For example, when should I add try/catch? Will the performance be reduced by adding too many try/catch statements? Today, I will
Http://hi.baidu.com/vincentwen/blog/item/b92d0923f1e4c64793580757.html Try Catch finally 1, the code that foresees the possibility of throwing an exception is included in the TRY statement block. 2. If an exception occurs, the execution of the catch
In the software development process, the program exception is very common, that is, we often say the bug, so we need to deal with unpredictable exceptions.Exception handling is actually very simple, at first I also have to be difficult, do not fear,
Reprint please mark: Shu Xiaolong http://www.cnblogs.com/shuxiaolong/archive/2013/04/10/3012439.html
Cause:
In most projects, try-catch is not added. Ask why and answer the question about performance;
However, no matter whether the details are
Question 1: Is the execution process different when a piece of code is surrounded by try blocks and no try is added without exceptions?
Question 2: if there is a difference, how much will the difference affect the performance?
Question 3: What is
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.