title: C# Throw exception without breaking the loop
body: <pre><code>void function() {
      try
      {
          // do something
  
          foreach (item in itemList)
          {
              try 
              {
                  //do something
              }
              catch (Exception ex)
              {
                  throw new Exception("functionB: " + ex.Message);
              }
          }
      }
      catch (Exception ex)
      {
          LogTransaction(ex.Message);
      }
  }
  </code></pre>
  
  <p>Hi, I would like to throw the exception from the for loop to its parent. Currently when there is an exception in the for loop, the loop will be terminated. 
  Is there anyway to modify it so that the exception will be thrown but the loop will continue?</p>