I have an error code here, because I can't check if string is equal to string[].
public void SetCh1Probe(string input)
{
string[] option= {"1:1", "1:10", "1:100"}
//I wanna check if input is equal to any of the string array
if (input != option.Any(x => x == option))
{
MessageBox.Show("Invalid Input");
}
else
{
//Proceed with other stuffs
}
}
I will have tons of methods like this, each with different string[] options. I really want to have a neat template that I can use for the rest of the methods. Can anybody help?
setting.Anyshould beoption.AnyIf I understand your question correctly