Not a problem, just a question:
You may write: trimmed = untrimmed.Trim('(', ')', '[', ']');
But you can't write: pos = line.IndexOfAny('(', ')', '[', ']');
... 'trimChars' is a 'params char[]', 'anyOf' is a 'char[]' (without 'params'). You must write: pos = line.IndexOfAny(new char[] {'(', ')', '[', ']')};
Is there any rational reason why 'anyOf' is not a 'params'?
My first thought was that it might mess up overloading, since no more parameters are allowed after a 'params'. There are IndexOfAny overloads with parameters trailing 'anyOf'. Maybe this would confuse the compiler.
No. String.Split() has one 'params char[]' overload, others with additional parameters (but for those, 'params' is omitted for the first, 'separator', parameter). If the compiler can handle Split(), why couldn't it handle the same constructions for IndexOfAny() and LastIndexOfAny()?
Did the programmer just forget about params, or is there a rational/technical reason?
What I have tried:
Function declarations mentioned are available in the metadata display in VS.