I want to use the Contains() in a switch statement in C# but I don't know how. If you don't understand me, I'll show you the code so maybe you'll understand I guess.
Code I want to work:
public void Read(string text)
{
switch (text.ToLower().Contains())
{
case "read":
MessageBox.Show(text);
break;
case "not":
MessageBox.Show(text);
break;
}
}
The upper code is the one I've attempted, but it doesn't work. So how can I use a function in a switch statement. I could use else if
s but I want to use it in a switch statement.