EqualsAny

public static bool EqualsAny(this string str, params string[] args) 
{ 		
    return args.Any(x=> 
      StringComparer.InvariantCultureIgnoreCase.Equals(x, str));		
}
Example:
string custName = "foo";
bool isMatch = (custName.EqualsAny("bar", "baz", "FOO")); //true

Description

Check that the given string is in a list of potential matches. Inspired by StackOverflow answer http://stackoverflow.com/a/20644611/23199

Details

Double click on the code to select all.

 

;