title: EF Core ToArray analog
body: <p>Most of you know that ToList(), ToArray() use a lot of memory because they recreate the array after N element. I need to get all rows from table and I wrote smth like this</p>
  <pre><code>ToArray(_dbContext.MyTable.Count(), _dbContext.MyTable.Select(x =&gt; ...})
  
  T[] ToArray&lt;T&gt;(int arraySize, IEnumerable&lt;T&gt; list)
      {
        var result = new T[arraySize];
        byte tempIndex = 0;
        foreach (var item in list)
        {
          result[tempIndex] = item;
          tempIndex++;
        }
        return result;
      }
  </code></pre>
  <p>This code uses about 10% less memory than simple</p>
  <pre><code>_dbContext.MyTable.Select(x =&gt; ...}).ToList() \ ToArray()
  </code></pre>
  <p>Does EF have something similar to my code?</p>