if语句是否可能等于C#的多种可能性?

Mos*_*rCJ 2 c# if-statement

if then语句是否有可能等于多种可能性?

例如

if(option1 == "a","b","c");
Run Code Online (Sandbox Code Playgroud)

mik*_*key 5

我经常希望同样的事情,这是我有时做的事情:

string[] optionOneVals = new string[3] {"a", "b", "c"};

if (optionOneVals.Contains(option1)) {
  ...
}
Run Code Online (Sandbox Code Playgroud)