c# - Put a return in catch {} block in a foreach loop -



c# - Put a return in catch {} block in a foreach loop -

i have code block (see below). so, if exception in work 1, code execution continue, , same work 2. go on work b or start new turn in foreach-loop? what's difference between catch {} , without return in it?

foreach (var item in arr) { //// work seek { // work 1 } grab { } seek { // work 2 } grab { return; } //// work b }

//ignore exception grab { } //continue next iteration grab { continue; } //exit loop grab { break; } //exit method grab { return; }

so reply question;

an exception in work 1 ignore exception , proceed run work 2.

an exception in work 2 exit method entirely.

c#

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -