Sheritlw
asked on
Convert a few lines of a C# formula to VB.Net
I have a line of code written in C# that I need to convert to Vb.Net.
All converters out there does not produce a result.
In C#
I have this block...
Later the length variable is assigned a value and used for other calculations
All of the above I have converted, except the following line.
What would be the correct conversion for this line?
Thanks
All converters out there does not produce a result.
In C#
I have this block...
// Calculate number of 64K blocks
uint rowsPerBlock = _MAXBLOCK/widthLength;
uint blockSize = rowsPerBlock*widthLength;
uint blockCount;
ushort length;
uint remainder=dcSize;
Later the length variable is assigned a value and used for other calculations
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
All of the above I have converted, except the following line.
comp.Write(BitConverter.GetBytes((ushort)~length), 0, 2);
What would be the correct conversion for this line?
Thanks
ASKER
Unfortunately ... the code, comp.Write(BitConverter.Ge tBytes(Dir ectCast(No t length, UShort), 0, 2) did not work. There is no GetBytes overload that accepts this number of arguments
And the developerfusion site I have used for years. Unfortunately it has not worked correctly for a while. I have tried other conversion tools, with no luck.
Any other ideas?
Thanks
And the developerfusion site I have used for years. Unfortunately it has not worked correctly for a while. I have tried other conversion tools, with no luck.
Any other ideas?
Thanks
Sorry, I forgot a paren:
comp.Write(BitConverter.GetBytes(DirectCast(Not length, UShort)), 0, 2)
ASKER
I now receive the following error.
Warning 5 Using DirectCast operator to cast a value-type to the same type is obsolete.
Thanks
Warning 5 Using DirectCast operator to cast a value-type to the same type is obsolete.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window