<p>just realised you can do this in C#</p><p>const int MaxStackAlloc = 1024;<br />Span&lt;int&gt; indices = count &lt;= MaxStackAlloc ? stackalloc int[count] : new int[count];</p><p>so you dynamically get stack or heap allocation depending on the count.</p>
Reply