title: Save a list after leaving the foreach loop
body: <p>So i am new to c# and i want to keep my list after leaving a loop....</p>
  
  <pre><code>             foreach (object itemChecked1 in clVorfahr.CheckedItems)
          {
               List&lt;object&gt; VorfahrCK = clVorfahr.CheckedItems.OfType&lt;object&gt;().ToList();
  
          }
  
          foreach (object itemChecked in clNachfolg.CheckedItems)
          {
               List&lt;object&gt; NachfolgCK = clNachfolg.CheckedItems.OfType&lt;object&gt;().ToList();
          }
  </code></pre>
  
  <p>After leaving this foreach loop my list is empty but when i debug and stop for each loop my list is getting data but after leaveing its completely empty</p>