我对 C# 还很陌生,对某些事情感到困惑.....
让我告诉你发生了什么,希望你们能告诉我我在这里做错了什么。
string incomming = Encoding.UTF8.GetString(bytes);
//MessageBox.Show(incomming); shows me the string "stop", No problem
executeCommand(incomming);
public void executeCommand(string action)
{
MessageBox.Show(action + " was recieved"); // shows the string "stop", No problem here... that works
switch (action)
{
case "start":
MessageBox.Show("start was recieved"); //shows nothing
break;
case "stop":
MessageBox.Show("stop was recieved"); //shows nothing
break;
}
}