结构如下
public struct UpdateKeyWords
{
public byte m_ucTableType;
public byte m_ucUpdateType;
public byte m_ucOperateType;
public UInt32 counts;
public SubKeyword[] keys;//动态开辟
}
public struct SubKeyword
{
public UInt32 m_uiWordLen;
public byte[] m_szWord;//动态开辟
}
在结构体上面加上这个属性
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct SubKeyword
{
public UInt32 m_uiWordLen;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
public byte[] m_szWord;//动态开辟
}