Table of Contents

Class ValidatorExtensions

Namespace
Cuemon.Extensions
Assembly
Cuemon.Extensions.Core.dll

Extension methods for the Validator class.

public static class ValidatorExtensions
Inheritance
Object
ValidatorExtensions

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

_ Validator

The Validator to extend.

argument String

The value to be evaluated.

characters Char[]

The sequence of System.Char to search within argument.

comparison StringComparison

One of the enumeration values that specifies the rules to use in the comparison.

message String

The message that describes the error.

paramName String

The name of the parameter that caused the exception.

Exceptions

System.ArgumentOutOfRangeException

argument contains one or more of the specified characters.

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

_ Validator

The Validator to extend.

keyword String

The 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 with keyword.

paramName String

The name of the parameter that caused the exception.

message String

A message that describes the error.

Exceptions

ReservedKeywordException

The specified keyword is contained within reservedKeywords.

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

_ Validator

The Validator to extend.

keyword String

The keyword to compare with reservedKeywords.

reservedKeywords IEnumerable<String>

The reserved keywords to compare with keyword.

paramName String

The name of the parameter that caused the exception.

message String

A message that describes the error.

Exceptions

ReservedKeywordException

The specified keyword is contained within reservedKeywords.

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

_ Validator

The Validator to extend.

first String

The value that specifies valid characters.

second String

The value to compare with first.

paramName String

The name of the parameter that caused the exception.

message String

A message that describes the error.

Exceptions

System.ArgumentOutOfRangeException

There is a difference between second and first.

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

_ Validator

The Validator to extend.

first String

The value that specifies valid characters.

second String

The value to compare with first.

paramName String

The name of the parameter that caused the exception.

message String

A message that describes the error.

Exceptions

System.ArgumentOutOfRangeException

There is no difference between second and first.

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

_ Validator

The Validator to extend.

argument String

The value to be evaluated.

characters Char[]

The sequence of System.Char to search within argument.

comparison StringComparison

One of the enumeration values that specifies the rules to use in the comparison.

message String

The message that describes the error.

paramName String

The name of the parameter that caused the exception.

Exceptions

System.ArgumentOutOfRangeException

argument does not contain any of the specified characters.