Size of struct C#
<p>I'm new in C#.<br>
I'm trying to understand why the struct size is grow.<br>
I.e:<br></p>

<pre><code>struct Test
{
    float x;
    int y;
    char z;
}
</code></pre>

<p>size of Test struct is actually 10 bytes (float=4, int=4, char=2).
<br>
But when i tried to get the sizeof struct with <code>Marshal.SizeOf(..)</code> method i got 12.<br>
In C++ i did <code>pragma pack(1)</code> to prevent this but how can i do it in C#?<br>
<br>Another question:<br>
When i tried to convert the Test struct to byte array if the struct isn't <code>[Serialize]</code> i got byte array with size 12 bytes as excepted (or not), but if the struct is <code>[Serialize]</code> i got byte array with size of 170 bytes, why its happend?<br>
Thanks! :)</p>