Generated by DocFX

Struct NumericRange

Represents a double range with minimum and maximum values, where values are single-precision double numbers.

Implements
IEquatable<NumericRange>
IEnumerable<System.Double>
Namespace: ISynergy.Framework.Core.Ranges
Assembly: ISynergy.Framework.Core.dll
Syntax
public struct NumericRange
Remarks

This class represents a double range with inclusive limits, where both minimum and maximum values of the range are included into it. Mathematical notation of such range is [min, max].

Examples
// create [0.25, 1.5] range
var range1 = new SingleRange(0.25f, 1.5f);

// create [1.00, 2.25] range
var range2 = new SingleRange(1.00f, 2.25f);

// check if values is inside of the first range
if (range1.IsInside(0.75f))
{
    // ...
}

// check if the second range is inside of the first range
if (range1.IsInside(range2))
{
    // ...
}

// check if two ranges overlap
if (range1.IsOverlapping(range2))
{
    // ...
}

Constructors

View Source

NumericRange(Byte, Byte, Boolean, Int32)

Initializes a new instance of the NumericRange class.

Declaration
public NumericRange(byte min, byte max, bool round = false, int decimals = 0)
Parameters
Type Name Description
System.Byte min

Minimum value of the range.

System.Byte max

Maximum value of the range.

System.Boolean round
System.Int32 decimals
View Source

NumericRange(Decimal, Decimal, Boolean, Int32)

Initializes a new instance of the NumericRange class.

Declaration
public NumericRange(decimal min, decimal max, bool round = false, int decimals = 0)
Parameters
Type Name Description
System.Decimal min

Minimum value of the range.

System.Decimal max

Maximum value of the range.

System.Boolean round
System.Int32 decimals
View Source

NumericRange(Double, Double, Boolean, Int32)

Initializes a new instance of the NumericRange class.

Declaration
public NumericRange(double min, double max, bool round = false, int decimals = 0)
Parameters
Type Name Description
System.Double min

Minimum value of the range.

System.Double max

Maximum value of the range.

System.Boolean round
System.Int32 decimals
View Source

NumericRange(Int32, Int32, Boolean, Int32)

Initializes a new instance of the NumericRange class.

Declaration
public NumericRange(int min, int max, bool round = false, int decimals = 0)
Parameters
Type Name Description
System.Int32 min

Minimum value of the range.

System.Int32 max

Maximum value of the range.

System.Boolean round
System.Int32 decimals
View Source

NumericRange(Int64, Int64, Boolean, Int32)

Initializes a new instance of the NumericRange class.

Declaration
public NumericRange(long min, long max, bool round = false, int decimals = 0)
Parameters
Type Name Description
System.Int64 min

Minimum value of the range.

System.Int64 max

Maximum value of the range.

System.Boolean round
System.Int32 decimals
View Source

NumericRange(Single, Single, Boolean, Int32)

Initializes a new instance of the NumericRange class.

Declaration
public NumericRange(float min, float max, bool round = false, int decimals = 0)
Parameters
Type Name Description
System.Single min

Minimum value of the range.

System.Single max

Maximum value of the range.

System.Boolean round
System.Int32 decimals

Properties

View Source

Length

Gets the length of the range, defined as (max - min).

Declaration
public readonly double Length { get; }
Property Value
Type Description
System.Double
View Source

Max

Maximum value of the range.

Declaration
public double Max { readonly get; set; }
Property Value
Type Description
System.Double
Remarks

Represents maximum value (right side limit) of the range [min, max].

View Source

Min

Minimum value of the range.

Declaration
public double Min { readonly get; set; }
Property Value
Type Description
System.Double
Remarks

Represents minimum value (left side limit) of the range [min, max].

Methods

View Source

Equals(NumericRange)

Indicates whether the current object is equal to another object of the same type.

Declaration
public bool Equals(NumericRange other)
Parameters
Type Name Description
NumericRange other

An object to compare with this object.

Returns
Type Description
System.Boolean

true if the current object is equal to the other parameter; otherwise, false.

View Source

Equals(Object)

Determines whether the specified , is equal to this instance.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj

The to compare with this instance.

Returns
Type Description
System.Boolean

true if the specified is equal to this instance; otherwise, false.

View Source

GetEnumerator()

Returns an enumerator that iterates through a collection.

Declaration
public IEnumerator<double> GetEnumerator()
Returns
Type Description
IEnumerator<System.Double>

An System.Collections.IEnumerator object that can be used to iterate through the collection.

View Source

GetHashCode()

Returns a hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

View Source

Intersection(NumericRange)

Computes the intersection between two ranges.

Declaration
public NumericRange Intersection(NumericRange range)
Parameters
Type Name Description
NumericRange range

The second range for which the intersection should be calculated.

Returns
Type Description
NumericRange

An new NumericRange structure containing the intersection between this range and the range given as argument.

View Source

IsInside(NumericRange)

Check if the specified range is inside of the range.

Declaration
public bool IsInside(NumericRange range)
Parameters
Type Name Description
NumericRange range

Range to check.

Returns
Type Description
System.Boolean

True if the specified range is inside of the range or false otherwise.

View Source

IsInside(Double)

Check if the specified value is inside of the range.

Declaration
public bool IsInside(double x)
Parameters
Type Name Description
System.Double x

Value to check.

Returns
Type Description
System.Boolean

True if the specified value is inside of the range or false otherwise.

View Source

IsOverlapping(NumericRange)

Check if the specified range overlaps with the range.

Declaration
public bool IsOverlapping(NumericRange range)
Parameters
Type Name Description
NumericRange range

Range to check for overlapping.

Returns
Type Description
System.Boolean

True if the specified range overlaps with the range or false otherwise.

View Source

ToRange(Boolean)

Converts this single-precision range into an NumericRange.

Declaration
public NumericRange ToRange(bool provideInnerRange)
Parameters
Type Name Description
System.Boolean provideInnerRange

Specifies if inner integer range must be returned or outer range.

Returns
Type Description
NumericRange

Returns integer version of the range.

Remarks

If provideInnerRange is set to true, then the returned integer range will always fit inside of the current single precision range. If it is set to false, then current single precision range will always fit into the returned integer range.

View Source

ToString()

Returns a that represents this instance.

Declaration
public override string ToString()
Returns
Type Description
System.String

A that represents this instance.

View Source

ToString(String, IFormatProvider)

Returns a that represents this instance.

Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type Name Description
System.String format

The format.

IFormatProvider formatProvider

The format provider.

Returns
Type Description
System.String

A that represents this instance.

Operators

View Source

Equality(NumericRange, NumericRange)

Determines whether two instances are equal.

Declaration
public static bool operator ==(NumericRange range1, NumericRange range2)
Parameters
Type Name Description
NumericRange range1
NumericRange range2
Returns
Type Description
System.Boolean
View Source

Inequality(NumericRange, NumericRange)

Determines whether two instances are not equal.

Declaration
public static bool operator !=(NumericRange range1, NumericRange range2)
Parameters
Type Name Description
NumericRange range1
NumericRange range2
Returns
Type Description
System.Boolean

Implements

IEquatable<>
IEnumerable<>

Extension Methods

EnumExtensions.GetSymbol<T>(T)
Vector.Interval(NumericRange, Int32)
Vector.Interval(NumericRange, Double)
Vector.Range(NumericRange)
Vector.Range(NumericRange, Double)
ArrayExtensions.Concatenate<T>(T, T[])
CollectionExtensions.FromHierarchy<TSource>(TSource, Func<TSource, TSource>, Func<TSource, Boolean>)
ObjectExtensions.Clone<T>(T)
ObjectExtensions.AddressOf<T>(T)
ObjectExtensions.ToByteArray<T>(T)
ReflectionExtensions.GetPropertyInfo<T, TValue>(T, Expression<Func<T, TValue>>)