Hi,
I have a bit of code which is causing me a few problems to port from C# to VB.NET
The C# looks like this
I've ported it, but the final if is causing a problem as I can't use ControlChars.Lf - the new code looks like this
Any idea on how to go about fixing this? It's the only part that fails
Paul
I have a bit of code which is causing me a few problems to port from C# to VB.NET
The C# looks like this
Code:
byte[] serverbuff = new Byte[1024];
int count = 0;
while (true)
{
byte[] buff = new Byte[2];
int bytes = stream.Read(buff, 0, 1 );
if (bytes == 1)
{
serverbuff[count] = buff[0];
count++;
if (buff[0] == '\n')
{
break;
}
}
else
{
break;
};
};
Code:
Dim serverbuff As Byte() = New [Byte](1023) {}
Dim count As Integer = 0
While (True)
Dim buff As Byte() = New [Byte](1) {}
Dim bytes As Integer = stream.Read(buff, 0, 1)
If (bytes = 1) Then
serverbuff(count) = buff(0)
count += 1
'The line below fails
If (buff(0) = ControlChars.Lf) Then
Exit While
End If
Else
Exit While
End If
End While
Paul
Comment