title: Different bool size
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/13233812/marshal-sizeof-structure-returns-excessive-number">Marshal.SizeOf structure returns excessive number</a>  </p>
  </blockquote>
  
  
  
  <p>As <a href="http://msdn.microsoft.com/en-us/library/eahchzkf.aspx" rel="nofollow noreferrer">MSDN</a> states that <code>sizeof(bool)</code> is <strong>1</strong> byte. But when I put bool in struct , sizeof struct become <strong>4</strong> byte. Can someone explain this behavior?</p>
  
  <pre><code>[StructLayout(LayoutKind.Sequential)]
  public struct Sample1
  {
      public bool a1;
  }
  
  int size1 = Marshal.SizeOf(typeof (Sample1));  // 4
  int size2 = sizeof (bool);                     // 1
  </code></pre>