Pip-Services-Commons-Dotnet
Static Public Member Functions | List of all members
PipServices3.Commons.Validate.ObjectComparator Class Reference

Helper class to perform comparison operations over arbitrary values. More...

Static Public Member Functions

static bool Compare (object value1, string operation, object value2)
 Perform comparison operation over two arguments. The operation can be performed over values of any type. More...
 
static bool AreEqual (object value1, object value2)
 Checks if two values are equal. The operation can be performed over values of any type. More...
 
static bool AreNotEqual (object value1, object value2)
 Checks if two values are NOT equal The operation can be performed over values of any type. More...
 
static bool IsLess (object value1, object value2)
 Checks if first value is less than the second one. The operation can be performed over numbers or strings. More...
 
static bool IsGreater (object value1, object value2)
 Checks if first value is greater than the second one. The operation can be performed over numbers or strings. More...
 
static bool Match (object value1, object value2)
 Checks if string matches a regular expression More...
 

Detailed Description

Helper class to perform comparison operations over arbitrary values.

ObjectComparator.Compare(2, "GT", 1); // Result: true
ObjectComparator.AreEqual("A", "B"); // Result: false

Member Function Documentation

◆ AreEqual()

static bool PipServices3.Commons.Validate.ObjectComparator.AreEqual ( object  value1,
object  value2 
)
static

Checks if two values are equal. The operation can be performed over values of any type.

Parameters
value1the first value to compare
value2the second value to compare
Returns
true if values are equal and false otherwise

◆ AreNotEqual()

static bool PipServices3.Commons.Validate.ObjectComparator.AreNotEqual ( object  value1,
object  value2 
)
static

Checks if two values are NOT equal The operation can be performed over values of any type.

Parameters
value1the first value to compare
value2the second value to compare
Returns
true if values are NOT equal and false otherwise

◆ Compare()

static bool PipServices3.Commons.Validate.ObjectComparator.Compare ( object  value1,
string  operation,
object  value2 
)
static

Perform comparison operation over two arguments. The operation can be performed over values of any type.

Parameters
value1the first argument to compare
operationthe comparison operation
value2the second argument to compare
Returns
result of the comparison operation

◆ IsGreater()

static bool PipServices3.Commons.Validate.ObjectComparator.IsGreater ( object  value1,
object  value2 
)
static

Checks if first value is greater than the second one. The operation can be performed over numbers or strings.

Parameters
value1the first value to compare
value2the second value to compare
Returns
true if the first value is greater than second and false otherwise.

◆ IsLess()

static bool PipServices3.Commons.Validate.ObjectComparator.IsLess ( object  value1,
object  value2 
)
static

Checks if first value is less than the second one. The operation can be performed over numbers or strings.

Parameters
value1the first value to compare
value2the second value to compare
Returns
true if the first value is less than second and false otherwise.

◆ Match()

static bool PipServices3.Commons.Validate.ObjectComparator.Match ( object  value1,
object  value2 
)
static

Checks if string matches a regular expression

Parameters
value1a string value to match
value2a regular expression string
Returns
true if the value matches regular expression and false otherwise.

The documentation for this class was generated from the following file: