C#结构中如何定义数组
public struct RETURN_OTDRip2
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
public string STPKSTR;//起始帧
public UInt32 PKLEN;//总帧长
public UInt32 REV;//版本号
public UInt32 PKTPY;//帧类型
public UInt32 SRC;//源地址
public UInt32 DST;//目的地址
public UInt32 PKID;//流水号
public UInt32 RSVD1;//保留字节1
public UInt32 CMDCODE;//命令码相应代码
public UInt32 DATLEN;//数据长度
public UInt32 datanum;
public UInt16[] arr = new UInt16[CHANGDU];
public UInt32 RSVD2;//保留字节2
}
用的是这个程序,运行就会报错。