title: Marshaling a c char array[128] to c#
body: <p>Simple question, but I can't find a straight answer: I want to have a char array of 128 bytes in my C structure. I am running this under 64bit Windows.  I want to marshal this over to c#, using the following:</p>
  
  <p>The C code:</p>
  
  <pre><code>typedef struct s_parameterStuct
  {
      int count;
      char name[ 128 ];
  } parameterStruct;
  </code></pre>
  
  <p>And the c# code:</p>
  
  <pre><code>[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
  public class parameterStuct
  {
      public int count;
  
      [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
      public char[] name;
  }
  </code></pre>
  
  <p>Since a char is 2 bytes in c#, should the SizeConst be 128 or 256.  Both seem to work fine, but I know only one of them is correct.</p>