title: ref foreach with List
body: <p>Why can't <code>ref var</code> be used within a <code>foreach</code> loop that iterates a <code>List&lt;T&gt;</code>?</p>
  <pre><code>Random rand = new();
  
  // This is fine
  Span&lt;int&gt; numbers = new int[] { 3, 14, 15, 92, 6 };
  foreach (ref var number in numbers)
  {
      number = rand.Next();
  }
  
  // This is not fine
  List&lt;int&gt; nums = new() { 3, 14, 15, 92, 6 };
  foreach (ref var number in nums)
  {
      number = rand.Next();
  }
  </code></pre>