I'm trying to marshal the following structure:
[StructLayout(LayoutKind.Sequential)]
public struct LogonTelegramStruct
{
[MarshalAs(UnmanagedType.I2)]
public ushort length;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 21)]
public string name;
[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr,
Size = (length-21)/5 )]
public string[] points;
}
How can I marshal the points array? The length of a single point is always 5 bytes. The length field gives the length of the rest of the structure. Therefore the points array size is (length-21)/5. Is it possible to marshal this without looping through each point?