[ StructLayout( LayoutKind.Sequential, CharSet=CharSet.Ansi )]
public
struct
MIBP_ItemInfo{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
//这里换成你实际的常量
public
string
ItemSN;
public
uint
ItemCount;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
//这里换成你实际的常量
public
string
ItemUnit;
}
[ StructLayout( LayoutKind.Sequential, CharSet=CharSet.Ansi )]
public
struct
MIBP_BindSetInfo{
[ MarshalAs( UnmanagedType.ByValArray, SizeConst=3 )]
//这里换成你实际的常量
public
byte
[] RFIDSN;
public
byte
ItemTypeCount;
public
IntPtr ItemInfo;
}
C#中结构体与字节流互相转换
就这两种
[ StructLayout( LayoutKind.Sequential, CharSet=CharSet.Ansi )]
public
struct
MIBP_ItemInfo{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
//这里换成你实际的常量
public
string
ItemSN;
public
uint
ItemCount;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
//这里换成你实际的常量
public
string
ItemUnit;
}
[ StructLayout( LayoutKind.Sequential, CharSet=CharSet.Ansi )]
public
struct
MIBP_BindSetInfo{
[ MarshalAs( UnmanagedType.ByValArray, SizeConst=3 )]
//这里换成你实际的常量
public
byte
[] RFIDSN;
public
byte
ItemTypeCount;
public
IntPtr ItemInfo;
}