delphi中的数据结构转换成C#怎么写?
时间:2011-10-29
来源:互联网
DevStruct =record
nDevID : UINT8;
nDevKind : UINT8;
nCOMPORT : UINT8;
nCOMBandRate : UINT8;
nUSBDevFlag : UINT8;
devIP : array[0..3] of UINT8;
IsTCP : BOOL;
TCP_UDPPort : UINT32;
end;
pDevStruct =^DevStruct;
这样写对么?
public struct DevStruct
{
public byte nDevID;
public byte nDevKind;
public Byte nCOMPORT;
public Byte nCOMBandRate;
public Byte nUSBDevFlag;
public Byte[] devIP;
public Boolean IsTCP;
public Int32 TCP_UDPPort;
}
nDevID : UINT8;
nDevKind : UINT8;
nCOMPORT : UINT8;
nCOMBandRate : UINT8;
nUSBDevFlag : UINT8;
devIP : array[0..3] of UINT8;
IsTCP : BOOL;
TCP_UDPPort : UINT32;
end;
pDevStruct =^DevStruct;
这样写对么?
public struct DevStruct
{
public byte nDevID;
public byte nDevKind;
public Byte nCOMPORT;
public Byte nCOMBandRate;
public Byte nUSBDevFlag;
public Byte[] devIP;
public Boolean IsTCP;
public Int32 TCP_UDPPort;
}
作者: wadyloo 发布时间: 2011-10-29
不知C#为何物
作者: qianchuan2010 发布时间: 2011-10-29
在C#里面测试一下你转化的这串代码是否能达到要求就知道行不行了;按照类型转换这样是可以.
作者: Robin95314852 发布时间: 2011-10-29
pdev.nDevID = 255;
pdev.nDevKind = 2;
pdev.devIP = new byte[4];
pdev.devIP[0] = 192;
pdev.devIP[1] = 168;
pdev.devIP[2] = 0;
pdev.devIP[3] = 10;
pdev.IsTCP = false;
pdev.TCP_UDPPort = 8000;
state = uFuncXClass.Units.uFuncXClass.CmdOpenDevice(pdev);
这个总是返回0,我怀疑转换有问题
pdev.nDevKind = 2;
pdev.devIP = new byte[4];
pdev.devIP[0] = 192;
pdev.devIP[1] = 168;
pdev.devIP[2] = 0;
pdev.devIP[3] = 10;
pdev.IsTCP = false;
pdev.TCP_UDPPort = 8000;
state = uFuncXClass.Units.uFuncXClass.CmdOpenDevice(pdev);
这个总是返回0,我怀疑转换有问题
作者: wadyloo 发布时间: 2011-10-29
别人转到C#后苦不堪言,你却自投罗网...猪脑
作者: xonln 发布时间: 2011-10-29
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28