I\'m using C# and I want to check if a string contains one of ten characters, *, &, # etc etc.
What is the best way?
The following would be the simplest method, in my view:
var match = str.IndexOfAny(new char[] { '*', '&', '#' }) != -1
Or in a possibly easier to read form:
var match = str.IndexOfAny("*".ToCharArray()) != -1
Depending on the context and performance required, you may or may not want to cache the char array.