المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Unassigned local variable



C# Programming
06-30-2009, 12:01 PM
I have a variable

byte[] rxData;

And VS is complaining that it is unassigned. However i dont want to assign it as this is done in the switch statement that follows.


does anyone know why it still complains

;switch (rxMessage[3])
{
case 0x46: // full Display Area
for (int i = 4; i <= 1028; i++)
{rxData[i - 4] = rxMessage[i];}
break;
case 0x42: // This command shall switch off the LCD and clear the LCD RAM
rxData[0] = 0;
break;
case 0x4f: // LCD On Off
rxData[0] = rxMessage[4];
break;
case 0x43:
rxData[0] = rxMessage[4];
break;
default:
//error
throw new InvalidDataException("Error: Incorrect Subcommand type may have been found");
}