I\'m doing an C# app where I use
if ((message.Contains(\"test\")))
{
Console.WriteLine(\"yes\");
} else if ((message.Contains(\"test2\"))) {
Console.W
This will work in C# 8 using a switch expresion
var message = "Some test message";
message = message switch
{
string a when a.Contains("test") => "yes",
string b when b.Contains("test2") => "yes for test2",
_ => "nothing to say"
};
For further references https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/switch-expression