In C#, I am creating multiple different structs that contain 16 variables of type bool. I will have several different of these structs that will then be combined with other data types into more complex structs. I am needing to have them treated as being 2 bytes in length. In the code below, a variable created of type CtrlWord1 will give a length of 64 when I do a Marshal.SizeOf regardless of whether it is created with a Pack value of 0, 1 or 2.
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct CtrlWord1
{
public bool a1;
public bool a2;
public bool a3;
public bool a4;
public bool a5;
public bool a6;
public bool a7;
public bool a8;
public bool b1;
public bool b2;
public bool b3;
public bool b4;
public bool c1;
public bool c2;
public bool c3;
public bool c4;
}