title: Pointer to struct containing System.Numerics.Vector<double> in C#
body: <p>I'm trying to make vector with 4 doubles with System.Numerics library because of SIMD. So I made this struct:</p>
  
  <pre><code>public struct Vector4D
  {
      System.Numerics.Vector&lt;double&gt; vecXY, vecZW;
  
      ...
  
  }
  </code></pre>
  
  <p>In this phase I code it for 128bit SIMD register.
  It works fine, but when I want something like this:</p>
  
  <pre><code>Vector4D* pntr = stackalloc Vector4D[8];
  </code></pre>
  
  <p>I get this:</p>
  
  <p><em>Cannot take the address of, get the size of, or declare a pointer to a managed type ('Vector4D')</em></p>
  
  <p>Any idea how to use stackalloc with System.Numerics.Vector? With System.Numerics.Vector4 (which is float-precision) there is no problem with pointers, but I need double-precision.</p>