title: Get SizeConst value for array in struct
body: <p>I have some (generated) c++ code that declares the following struct in a DLL:</p>
  
  <pre><code>[StructLayout(LayoutKind::Sequential, Pack = 4)] public value struct typeData
  {
  public:
     [MarshalAs(UnmanagedType::ByValArray, SizeConst = 8)] array&lt;UINT8&gt; ^ a1;
     [MarshalAs(UnmanagedType::ByValArray, SizeConst = 20)] array&lt;UINT8&gt; ^ a2;
  };
  </code></pre>
  
  <p>From my C# application, I would like to find out the expected lengths of the arrays (8 and 20 in the example).</p>
  
  <p>I have loaded the DLL, and created an instance of the object as </p>
  
  <pre><code>dll = Assembly.LoadFrom("data.dll");
  var t = dll.GetType("typeData");
  var obj = Activator.CreateInstance(t);
  </code></pre>
  
  <p>Can I get the desired information from the type or the object? Or in some other way?</p>