title: Marshal struct to unmanaged array
body: <p>I have a C# struct to represent a cartesian vector, something like this:</p>
  
  <pre><code>public struct Vector  
  {  
      private double x;  
      private double y;  
      private double z;  
  
      //Some properties/methods
  }
  </code></pre>
  
  <p>Now I have an unmanaged C dll that I need to call with P/Invoke. Some methods expect a double[3] parameter.</p>
  
  <p>The unmanaged C signature is something like  </p>
  
  <pre><code>void Cross(double a[3], double b[3], double c[3]);  
  </code></pre>
  
  <p>Is there any way to set up a P/Invoke signature so I can pass instances of my Vector struct and marshal them transparently to unmanaged double[3]? I would also need bidirectional marshaling as the unmanaged function needs to write the output to the argument array, so I guess I would need to marshal as LpArray.</p>