title: Are there any side effects of returning from inside a foreach statement?
body: <p>Similar to my question about <a href="https://stackoverflow.com/questions/2369887/are-there-any-side-effects-of-returning-from-inside-a-using-statement">returning from inside a <strong>using statement</strong></a> (whose answer was generally "<strong>yes, it's ok</strong>") I'm wondering if returning from <strong>inside a foreach</strong> statement is similarly devoid of <strong>side-effects</strong> and considered <strong>accepted practice</strong>, or when I do this am I leaving a <strong>pointer</strong> hanging in the middle an <strong>enumeration</strong> somewhere internally, etc.</p>
  
  <p>Here's an example:</p>
  
  <pre><code>public string GetCurrentTransaction(string idText)
  {
      foreach (var transaction in transactions)
      {
          if (idText.IsEquivalentTo(transaction.IdText))
          {
              return transaction.Content;
          }
      }
      return "";
  }
  </code></pre>