Class ValidatorExtensions
- Namespace
- Cuemon.Extensions
- Assembly
- Cuemon.Extensions.Core.dll
Extension methods for the Validator class.
public static class ValidatorExtensions
- Inheritance
-
ObjectValidatorExtensions
Methods
ContainsAny(Validator, String, Char[], StringComparison, String, String)
Validates and throws an System.ArgumentOutOfRangeException if any of the characters
occurs within the argument
.
public static void ContainsAny(this Validator _, string argument, char[] characters, StringComparison comparison = StringComparison.OrdinalIgnoreCase, string message = "One or more character matches were found.", string paramName = null)
Parameters
_
ValidatorThe Validator to extend.
argument
StringThe value to be evaluated.
characters
Char[]The sequence of System.Char to search within
argument
.comparison
StringComparisonOne of the enumeration values that specifies the rules to use in the comparison.
message
StringThe message that describes the error.
paramName
StringThe name of the parameter that caused the exception.
Exceptions
- System.ArgumentOutOfRangeException
argument
contains one or more of the specifiedcharacters
.
ContainsReservedKeyword(Validator, String, IEnumerable<String>, IEqualityComparer<String>, String, String)
Validates and throws a ReservedKeywordException if the specified keyword
is found in the sequence of reservedKeywords
.
public static void ContainsReservedKeyword(this Validator _, string keyword, IEnumerable<string> reservedKeywords, IEqualityComparer<string> comparer, string paramName = null, string message = null)
Parameters
_
ValidatorThe Validator to extend.
keyword
StringThe keyword to compare with
reservedKeywords
.reservedKeywords
IEnumerable<String>The reserved keywords to compare with
keyword
.comparer
IEqualityComparer<String>The System.Collections.Generic.IEqualityComparer<T> implementation to use when comparing
reservedKeywords
withkeyword
.paramName
StringThe name of the parameter that caused the exception.
message
StringA message that describes the error.
Exceptions
- ReservedKeywordException
The specified
keyword
is contained withinreservedKeywords
.
ContainsReservedKeyword(Validator, String, IEnumerable<String>, String, String)
Validates and throws a ReservedKeywordException if the specified keyword
is found in the sequence of reservedKeywords
.
public static void ContainsReservedKeyword(this Validator _, string keyword, IEnumerable<string> reservedKeywords, string paramName = null, string message = null)
Parameters
_
ValidatorThe Validator to extend.
keyword
StringThe keyword to compare with
reservedKeywords
.reservedKeywords
IEnumerable<String>The reserved keywords to compare with
keyword
.paramName
StringThe name of the parameter that caused the exception.
message
StringA message that describes the error.
Exceptions
- ReservedKeywordException
The specified
keyword
is contained withinreservedKeywords
.
HasDifference(Validator, String, String, String, String)
Validates and throws an System.ArgumentOutOfRangeException if there is a difference between second
and first
.
public static void HasDifference(this Validator _, string first, string second, string paramName, string message = null)
Parameters
_
ValidatorThe Validator to extend.
first
StringThe value that specifies valid characters.
second
StringThe value to compare with
first
.paramName
StringThe name of the parameter that caused the exception.
message
StringA message that describes the error.
Exceptions
- System.ArgumentOutOfRangeException
There is a difference between
second
andfirst
.
NoDifference(Validator, String, String, String, String)
Validates and throws an System.ArgumentOutOfRangeException if there is no difference between second
and first
.
public static void NoDifference(this Validator _, string first, string second, string paramName, string message = null)
Parameters
_
ValidatorThe Validator to extend.
first
StringThe value that specifies valid characters.
second
StringThe value to compare with
first
.paramName
StringThe name of the parameter that caused the exception.
message
StringA message that describes the error.
Exceptions
- System.ArgumentOutOfRangeException
There is no difference between
second
andfirst
.
NotContainsAny(Validator, String, Char[], StringComparison, String, String)
Validates and throws an System.ArgumentOutOfRangeException if any of the characters
does not occur within the argument
.
public static void NotContainsAny(this Validator _, string argument, char[] characters, StringComparison comparison = StringComparison.OrdinalIgnoreCase, string message = "No matching characters were found.", string paramName = null)
Parameters
_
ValidatorThe Validator to extend.
argument
StringThe value to be evaluated.
characters
Char[]The sequence of System.Char to search within
argument
.comparison
StringComparisonOne of the enumeration values that specifies the rules to use in the comparison.
message
StringThe message that describes the error.
paramName
StringThe name of the parameter that caused the exception.
Exceptions
- System.ArgumentOutOfRangeException
argument
does not contain any of the specifiedcharacters
.