c# - Does an exception inside a TRY block break its execution? -
I am importing several fields, and that is, about 25 lines of code importing each single field (my In the case, there really is no other way). It's in a try-catching block, but there may be some time, that this field is not present in the source, but I have to rest.
to 20. - I do not have 10 <11th one (exception) I still need 12 to 20.
If I do not want to test existence one by one, then I would like to know how it works. In the case of an exception, it does not fix the rest, is it? May be fit for me?
obs: It's more than 20 ways, I want a smart and non-politoling solution for it.
If an attempt is made within block, after the exception, nothing will be executed. Therefore, if there is an exception on item 11, item 12-20 will not be executed. The execution item will jump from 11 to the catch block and eventually block the block. Finally there is the block.
What has been said to your question, when no field exists, an exception is obtained. I check to see if the field exists, and then do the operation I do not advise to use an attempt to hold an attempt as an instrument to check the existence of an existence. The catch should be to deal with the error, and if you get an error, then you generally do not want to continue with the normal execution. If you do not like the idea of checking the position on each line, or there is no other way to check other than catching the exception, then I suggest trying to do a function with trying to try it in.
Boolean checkfield (field) {to hold / {do} operation on field (exception e) {return false;} right back; } Zero main () {if! (CheckField (Field 1)) returns; and if! (Checkfield (field 2)) return; . . . }
Comments
Post a Comment