What I have:
(tcp stuff here)
data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
switch (data)
{
case (data.Substring(0,6)=="send /":
MessageBox.Show(data.Substring(6).....)
break;
case (....):
.....
break;
.......
}
The error: cant implicitly convert bool to string. This is from the case statements. I would use an if statement but when I do that, It freaks out if I type something anything that is not evaluated. I did try:
if (...)
{
...
}
else if (...)
{
...
}
else
{
continue;
}
and that didnt work. switch case seems to work better in this scenario. But unlike in VB, i cant put the substring evaluation in the case declaration. I can do this:
switch (data.Substring(length of the smallest command to be sent))
Thats fine, but I like my way better because there will be less confusion. However, there is the aforementioned error. If i did the latter way, I would have cases like this:
case"sen":
when they should be like this:
case "send /"
does anyone know if my way is possible?