将GetBytes C#行转换为VB.Net
我有一行用C语言编写的代码,需要转换为Vb.Net 在C中# 我有这个街区将GetBytes C#行转换为VB.Net,c#,.net,vb.net,C#,.net,Vb.net,我有一行用C语言编写的代码,需要转换为Vb.Net 在C中# 我有这个街区 // Calculate number of 64K blocks uint rowsPerBlock = _MAXBLOCK/widthLength; uint blockSize = rowsPerBlock*widthLength; uint blockCount; ushort length; uint re
// Calculate number of 64K blocks
uint rowsPerBlock = _MAXBLOCK/widthLength;
uint blockSize = rowsPerBlock*widthLength;
uint blockCount;
ushort length;
uint remainder=dcSize;
稍后,将为长度变量指定一个值并用于其他计算
length = (ushort)((remainder < blockSize) ? remainder : blockSize);
if (length == remainder)
{
comp.WriteByte(0x01);
}
else
{
comp.WriteByte(0x00);
}
comp.Write(BitConverter.GetBytes(length), 0, 2);
// Write one's compliment of LEN
这一行的正确转换是什么
谢谢这将在VB.Net中用于执行位求反:
comp.Write(BitConverter.GetBytes(CUShort(Not length)), 0, 2)
您可以尝试使用此代码
Dim byteArray As Byte( ) = BitConverter.GetBytes( (CUShort)Not length)
comp.Write(byteArray , 0, 2);
链接BitConverter.GetBytes:
链接不是:转换器。
Dim byteArray As Byte( ) = BitConverter.GetBytes( (CUShort)Not length)
comp.Write(byteArray , 0, 2);