Ahoj,
zakladam nove tema, souvisejici s predchazejicim dotazem, ale na jine tema.
zjistil jsem, ze VB.Net pro .Net microframework asi postrada operatory. V cem je problem?
mam kod v c#, ktery funguje jak ma:
public float GetTemperature()
{
byte[] readBuffer = new byte[2];
// Get MSB and LSB together
int temp = readBuffer[0];
temp <<= 8;
temp |= readBuffer[1];
// Negative value test (subzero temperature)
temp -= (readBuffer[0] >= 0x80) ? 65536 : 0;
// Get the temperature in Celsius
return (float)((temp >> 4) * 0.0625);
}
a pak stejny kod ve VB.net, ktery v desktopove aplikaci funguje, ale v .Net MF uz nejde kompilovat prave kvuli operatorum "<<=" a ">>"
Public Function CorretedTemp(readBuffer As Byte()) As Single
' Get MSB and LSB together
Dim temp As Integer = readBuffer(0)
temp <<= 8
temp = (temp Or readBuffer(1))
' Negative value test (subzero temperature)
temp -= If((readBuffer(0) >= &H80), 65536, 0)
' Get the temperature in Celsius
Return CSng((temp >> 4) * 0.0625)
End Function
Muj dotaz tedy zni, jestli je to chyba .Net MF, nebo delam chybu nekde ja? Pripadne, jestli jde dane operatory nejak nahradit.
Dekuji Adrian