我有一行用C#编写的代码,我需要转换为Vb.Net.
在C#中
我有这个块......
// Calculate number of 64K blocks
uint rowsPerBlock = _MAXBLOCK/widthLength;
uint blockSize = rowsPerBlock*widthLength;
uint blockCount;
ushort length;
uint remainder=dcSize;
Run Code Online (Sandbox Code Playgroud)
稍后,长度变量被赋值为一个值并用于其他计算
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
Run Code Online (Sandbox Code Playgroud)
以上所有我已转换,除了以下行.
comp.Write(BitConverter.GetBytes((ushort)~length), 0, 2);
Run Code Online (Sandbox Code Playgroud)
这条线的正确转换是什么?
谢谢
这将Not在VB.Net中用于执行按位否定:
comp.Write(BitConverter.GetBytes(CUShort(Not length)), 0, 2)
Run Code Online (Sandbox Code Playgroud)