CVB.Net 15.0
ValueRange< TValue > Struct Template Reference

Container for range definitions. More...

Public Member Functions

 ValueRange (TValue min, TValue max)
 Initialize a ValueRange object. More...
 
bool Contains (TValue val)
 Check if a value is within the range. More...
 
bool IntersectsWith (ValueRange< TValue > other)
 Check if this value range intersects with another value range. More...
 
override int GetHashCode ()
 Standard hashing function. More...
 
override bool Equals (object obj)
 Equality check for ValueRange structures. More...
 

Static Public Member Functions

static bool operator== (ValueRange< TValue > lhs, ValueRange< TValue > rhs)
 Equality check for two ValueRange structures. More...
 
static bool operator!= (ValueRange< TValue > lhs, ValueRange< TValue > rhs)
 Inequality check for two ValueRange structures. More...
 

Properties

TValue Min [get, set]
 Minimum value. More...
 
TValue Max [get, set]
 Maximum value. More...
 

Detailed Description

Container for range definitions.

Template Parameters
TValuetype of value
Type Constraints
TValue :IComparable<TValue> 

Constructor & Destructor Documentation

◆ ValueRange()

ValueRange ( TValue  min,
TValue  max 
)

Initialize a ValueRange object.

Parameters
minminimum value
maxmaximum value

Member Function Documentation

◆ Contains()

bool Contains ( TValue  val)

Check if a value is within the range.

Parameters
valValue to be checked
Returns
true if val is within the range defined by this object, false otherwise.

◆ Equals()

override bool Equals ( object  obj)

Equality check for ValueRange structures.

Parameters
objobject to compare to
Returns
true if this object and the object referred to by obj are identical, false otherwise.

◆ GetHashCode()

override int GetHashCode ( )

Standard hashing function.

Returns
Hash code for the current object.

◆ IntersectsWith()

bool IntersectsWith ( ValueRange< TValue >  other)

Check if this value range intersects with another value range.

Parameters
otherObject for intersection test.
Returns
true if this range and the other range have at least one value in common, false otherwise

◆ operator!=()

static bool operator!= ( ValueRange< TValue >  lhs,
ValueRange< TValue >  rhs 
)
static

Inequality check for two ValueRange structures.

Parameters
lhsleft hand side
rhsright hand side
Returns
true if lhs and rhs are different, false otherwise.

◆ operator==()

static bool operator== ( ValueRange< TValue >  lhs,
ValueRange< TValue >  rhs 
)
static

Equality check for two ValueRange structures.

Parameters
lhsleft hand side
rhsright hand side
Returns
true if lhs and rhs are identical, false otherwise.

Property Documentation

◆ Max

TValue Max
getset

Maximum value.

Exceptions
ArgumentExceptionwhen trying to set a value that is lower than the currently set Min value

◆ Min

TValue Min
getset

Minimum value.

Exceptions
ArgumentExceptionwhen trying to set a value that exceeds the currently set Max value