ThrowIfContainsAny Method
Definition
ThrowIfContainsAny(string, char[], StringComparison, string, string)
Validates and throws an ArgumentOutOfRangeException if any of the characters occurs within the argument.
public static void ThrowIfContainsAny(string argument, char[] characters, StringComparison comparison = StringComparison.OrdinalIgnoreCase, string message = "One or more character matches were found.", string paramName = null)
Parameters
argumentstringThe value to be evaluated.
characterschar[]The sequence of char to search within
argument.comparisonStringComparisonOne of the enumeration values that specifies the rules to use in the comparison.
messagestringThe message that describes the error.
paramNamestringThe name of the parameter that caused the exception.
Exceptions
- ArgumentOutOfRangeException
argumentcontains one or more of the specifiedcharacters.