I have a variable named as "Input". This variable is the value of an input field. On the other side I have a List containing lot of strings
List<string> names = new List<string>() { "Franz","Hans","Frank","Holger","Reiner".... };
I want to check whether the Operator's Input value is equal to one of the elements of my list. Normaly I would write a very long logical or expression like
If(Input=="Franz" || Input=="Hans" || Input=="Frank" ... ) // hundreds of or's..
{
DoSomething();
}
Isn't there an easier way to check whether the "Input" variable's value is equal to one of the List's elements, without using logical OR expression ?