I'm attempting to create a method which checks whether a String contains any Strings contained within an IEnumerable<String>.My method so far is this:
public static Boolean ContainsAny(this String Self, IEnumerable<String> Fragments, StringComparer CompareType = StringComparer.CurrentCulture) { foreach (var fragment in Fragments) { if (Self.Contains(fragment,CompareType)) { return true; } } return false; } However, this won't compile because StringComparer.CurrentCulture ins't a compile time constant as shown by this error:
> Error 1 Default parameter value for 'CompareType' must be a > compile-time constant My question is, what is an acceptable default value which I can use for CompareType which will result in the same behavior as if it were possible to have it default to StringComparer.CurrentCulture?