我正在尝试完成这项工作,但我收到此错误..
因为它包含偏移量 0 处的对象字段,该对象字段未正确对齐或被非对象字段重叠。
[StructLayout(LayoutKind.Explicit)]
public struct ListEntry {
[System.Runtime.InteropServices.FieldOffset(0)]
[MarshalAs(UnmanagedType.ByValArray, SizeConst=17)]
public byte[] raw;
[System.Runtime.InteropServices.FieldOffset(0)]
public byte version;
[System.Runtime.InteropServices.FieldOffset(1)]
public UInt16 magic;
[System.Runtime.InteropServices.FieldOffset(3)]
public UInt32 start_time;
[System.Runtime.InteropServices.FieldOffset(7)]
public UInt16 run_id;
[System.Runtime.InteropServices.FieldOffset(9)]
public UInt16 channels;
[System.Runtime.InteropServices.FieldOffset(11)]
public UInt16 sampling_rate;
[System.Runtime.InteropServices.FieldOffset(13)]
public UInt32 start_sector;
}