以下代码怎么转换成vb代码
uintdummy=0;byte[]inOptionValues=newbyte[Marshal.SizeOf(dummy)*3];BitConverter.GetByt...
uint dummy = 0;
byte[] inOptionValues = new byte[Marshal.SizeOf(dummy) * 3];
BitConverter.GetBytes((uint)1).CopyTo(inOptionValues, 0);//是否启用Keep-Alive
BitConverter.GetBytes((uint)5000).CopyTo(inOptionValues, Marshal.SizeOf(dummy));//多长时间开始第一次探测
BitConverter.GetBytes((uint)5000).CopyTo(inOptionValues, Marshal.SizeOf(dummy) * 2);//探测时间间隔 展开
byte[] inOptionValues = new byte[Marshal.SizeOf(dummy) * 3];
BitConverter.GetBytes((uint)1).CopyTo(inOptionValues, 0);//是否启用Keep-Alive
BitConverter.GetBytes((uint)5000).CopyTo(inOptionValues, Marshal.SizeOf(dummy));//多长时间开始第一次探测
BitConverter.GetBytes((uint)5000).CopyTo(inOptionValues, Marshal.SizeOf(dummy) * 2);//探测时间间隔 展开
1个回答
展开全部
这是C#代码,只能转成vb.net,如果要用vb6实现这个功能另算。
vb.net代码:
Dim dummy As UInteger = 0
Dim inOptionValues As Byte() = New Byte(Marshal.SizeOf(dummy) * 3 - 1) {}
BitConverter.GetBytes(CUInt(1)).CopyTo(inOptionValues, 0)
'是否启用Keep-Alive
BitConverter.GetBytes(CUInt(5000)).CopyTo(inOptionValues, Marshal.SizeOf(dummy))
'多长时间开始第一次探测
BitConverter.GetBytes(CUInt(5000)).CopyTo(inOptionValues, Marshal.SizeOf(dummy) * 2)
'探测时间间
vb.net代码:
Dim dummy As UInteger = 0
Dim inOptionValues As Byte() = New Byte(Marshal.SizeOf(dummy) * 3 - 1) {}
BitConverter.GetBytes(CUInt(1)).CopyTo(inOptionValues, 0)
'是否启用Keep-Alive
BitConverter.GetBytes(CUInt(5000)).CopyTo(inOptionValues, Marshal.SizeOf(dummy))
'多长时间开始第一次探测
BitConverter.GetBytes(CUInt(5000)).CopyTo(inOptionValues, Marshal.SizeOf(dummy) * 2)
'探测时间间
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询