Let's say I have a code like this:
try { for (int i = 0; i < 10; i++) { if (i == 2 || i == 4) { throw new Exception("Test " + i); } } } catch (Exception ex) { errorLog.AppendLine(ex.Message); }
Now itβs obvious that execution will stop at i==2 , but I want it to complete the entire iteration, so that there are two entries in errorLog (for i==2 and i==4 ) So, is it possible to continue the iteration, even an exception is thrown ?
source share