savetext is a string with a random length + "! Command1"
switch (savetext)
{
case savetext.EndsWith("! Command1"):
System.Diagnostics.Debug.WriteLine("Test1");
break;
case savetext.EndsWith("! Command2"):
System.Diagnostics.Debug.WriteLine("Test2");
break;
default:
System.Diagnostics.Debug.WriteLine(savetext)
break;
}
The output should be "Test1" but my method here is isnt working like I want. How can I fix this?