I was stunned to find that the following was a problem in VB.Net:
The result is a squiggly blue line under the "+=" part and the error message read:
The result was the same error message and the squiggly line this time was under "bytes(i) +1".
However, the following is just fine in C# however:
Does anyone have an idea of what might be going on in the VB.Net example? It seems kind of ludicrous to have to make use of the Convert class to convert a Byte to istelf??
Thanks in advance...
Visual Basic:
Dim bytes() As Byte = {1, 2, 3, 4, 5}
Dim i as Integer
For i = 0 To bytes.Length - 1
bytes(i) += 1 ' <-- Compile Time Error
Next
This was puzzling, so just to make sure that I wasn't going insane, I tried changing the offending line to:Option Strict On disallows implicit conversions from 'Integer' to 'Byte'
Visual Basic:
bytes(i) = bytes(i) + 1
However, the following is just fine in C# however:
Code:
byte[] bytes = {1,2,3,4,5};
int i = 0;
for(i=0; i<bytes.Length; i++)
{
bytes[i] +=1;
}
Thanks in advance...