Gorgon
Show / Hide Table of Contents

Struct GorgonRangeM

A type that represents a range between two decimal values.

Implements
IGorgonEquatableByRef<GorgonRangeM>
IEquatable<GorgonRangeM>
IComparable<GorgonRangeM>
Inherited Members
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetType()
Namespace: Gorgon.Core
Assembly: Gorgon.Core.dll
Syntax
public readonly struct GorgonRangeM : IGorgonEquatableByRef<GorgonRangeM>, IEquatable<GorgonRangeM>, IComparable<GorgonRangeM>
Remarks

This a means to determine the range between a minimum decimal value and a maximum decimal value. Use this object to determine if a value falls within a specific range of values.

Constructors

| Edit this page View Source

GorgonRangeM(GorgonRangeM)

Initializes a new instance of the GorgonRangeM struct.

Declaration
public GorgonRangeM(GorgonRangeM minMax)
Parameters
Type Name Description
GorgonRangeM minMax

The min max value to copy.

| Edit this page View Source

GorgonRangeM(decimal, decimal)

Initializes a new instance of the GorgonRangeM struct.

Declaration
public GorgonRangeM(decimal min, decimal max)
Parameters
Type Name Description
decimal min

The minimum value.

decimal max

The maximum value.

Fields

| Edit this page View Source

Empty

An empty range value.

Declaration
public static readonly GorgonRangeM Empty
Field Value
Type Description
GorgonRangeM
| Edit this page View Source

Maximum

The maximum value in the range.

Declaration
public readonly decimal Maximum
Field Value
Type Description
decimal
| Edit this page View Source

Minimum

The minimum value in the range.

Declaration
public readonly decimal Minimum
Field Value
Type Description
decimal

Properties

| Edit this page View Source

IsEmpty

Property to return whether the range is empty or not.

Declaration
[JsonIgnore]
public bool IsEmpty { get; }
Property Value
Type Description
bool
| Edit this page View Source

Range

Property to return the range between the two values.

Declaration
[JsonIgnore]
public decimal Range { get; }
Property Value
Type Description
decimal

Methods

| Edit this page View Source

Add(GorgonRangeM, GorgonRangeM)

Function to add two GorgonRangeM values together.

Declaration
public static GorgonRangeM Add(GorgonRangeM left, GorgonRangeM right)
Parameters
Type Name Description
GorgonRangeM left

The left GorgonRangeM value to add

GorgonRangeM right

The right GorgonRangeM value to add.

Returns
Type Description
GorgonRangeM

A new GorgonRangeM representing the total of both ranges.

| Edit this page View Source

Add(in GorgonRangeM, in GorgonRangeM, out GorgonRangeM)

Function to add two GorgonRangeM values together.

Declaration
public static void Add(in GorgonRangeM left, in GorgonRangeM right, out GorgonRangeM result)
Parameters
Type Name Description
GorgonRangeM left

The left GorgonRangeM value to add

GorgonRangeM right

The right GorgonRangeM value to add.

GorgonRangeM result

A new GorgonRangeM representing the total of both ranges.

| Edit this page View Source

CompareTo(GorgonRangeM)

Compares the current object with another object of the same type.

Declaration
public int CompareTo(GorgonRangeM other)
Parameters
Type Name Description
GorgonRangeM other

An object to compare with this object.

Returns
Type Description
int

A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the other parameter.Zero This object is equal to other. Greater than zero This object is greater than other.

| Edit this page View Source

Contains(decimal)

Function to return whether the decimal value falls within this GorgonRangeM.

Declaration
public bool Contains(decimal value)
Parameters
Type Name Description
decimal value

Value to test.

Returns
Type Description
bool

true if the value falls into the range, false if not.

| Edit this page View Source

Divide(GorgonRangeM, decimal)

Function to divide a GorgonRangeM by a decimal value.

Declaration
public static GorgonRangeM Divide(GorgonRangeM range, decimal scalar)
Parameters
Type Name Description
GorgonRangeM range

The GorgonRangeM range value to divide.

decimal scalar

The decimal scalar value to divide by.

Returns
Type Description
GorgonRangeM

A new GorgonRangeM representing the product of the range and the scalar.

Exceptions
Type Condition
DivideByZeroException

Thrown if the scalar value is zero.

| Edit this page View Source

Divide(in GorgonRangeM, decimal, out GorgonRangeM)

Function to divide a GorgonRangeM by a decimal value.

Declaration
public static void Divide(in GorgonRangeM range, decimal scalar, out GorgonRangeM result)
Parameters
Type Name Description
GorgonRangeM range

The GorgonRangeM range value to divide.

decimal scalar

The decimal scalar value to divide by.

GorgonRangeM result

A new GorgonRangeM representing the product of the range and the scalar.

Exceptions
Type Condition
DivideByZeroException

Thrown if the scalar value is zero.

| Edit this page View Source

Equals(GorgonRangeM)

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

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

An object to compare with this object.

Returns
Type Description
bool

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

| Edit this page View Source

Equals(in GorgonRangeM)

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

Declaration
public bool Equals(in GorgonRangeM other)
Parameters
Type Name Description
GorgonRangeM other

An object to compare with this object.

Returns
Type Description
bool

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

| Edit this page View Source

Equals(object)

Indicates whether this instance and a specified object are equal.

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

Another object to compare to.

Returns
Type Description
bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Overrides
ValueType.Equals(object)
| Edit this page View Source

Expand(GorgonRangeM, decimal)

Function to expand a GorgonRangeM by a specific amount.

Declaration
public static GorgonRangeM Expand(GorgonRangeM range, decimal amount)
Parameters
Type Name Description
GorgonRangeM range

A GorgonRangeM to expand.

decimal amount

The amount to expand the GorgonRangeM by.

Returns
Type Description
GorgonRangeM

A new GorgonRangeM value, increased in size by amount.

| Edit this page View Source

Expand(in GorgonRangeM, decimal, out GorgonRangeM)

Function to expand a GorgonRangeM by a specific amount.

Declaration
public static void Expand(in GorgonRangeM range, decimal amount, out GorgonRangeM result)
Parameters
Type Name Description
GorgonRangeM range

A GorgonRangeM to expand.

decimal amount

The amount to expand the GorgonRangeM by.

GorgonRangeM result

A new GorgonRangeM value, increased in size by amount.

| Edit this page View Source

GetHashCode()

Returns the hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
int

A 32-bit signed integer that is the hash code for this instance.

Overrides
ValueType.GetHashCode()
| Edit this page View Source

Multiply(GorgonRangeM, GorgonRangeM)

Function to multiply two GorgonRangeM ranges together.

Declaration
public static GorgonRangeM Multiply(GorgonRangeM left, GorgonRangeM right)
Parameters
Type Name Description
GorgonRangeM left

The left GorgonRangeM value to multiply.

GorgonRangeM right

The right GorgonRangeM value to multiply.

Returns
Type Description
GorgonRangeM

A new GorgonRangeM value representing the product of both ranges.

| Edit this page View Source

Multiply(GorgonRangeM, decimal)

Function to multiply a GorgonRangeM by a scalar decimal value.

Declaration
public static GorgonRangeM Multiply(GorgonRangeM range, decimal scalar)
Parameters
Type Name Description
GorgonRangeM range

The range to multiply by.

decimal scalar

The decimal scalar value to multiply.

Returns
Type Description
GorgonRangeM

A new GorgonRangeM representing the product of the range and the scalar.

| Edit this page View Source

Multiply(in GorgonRangeM, in GorgonRangeM, out GorgonRangeM)

Function to multiply two GorgonRangeM ranges together.

Declaration
public static void Multiply(in GorgonRangeM left, in GorgonRangeM right, out GorgonRangeM result)
Parameters
Type Name Description
GorgonRangeM left

The left GorgonRangeM value to multiply.

GorgonRangeM right

The right GorgonRangeM value to multiply.

GorgonRangeM result

A new GorgonRangeM value representing the product of both ranges.

| Edit this page View Source

Multiply(in GorgonRangeM, decimal, out GorgonRangeM)

Function to multiply a GorgonRangeM by a scalar decimal value.

Declaration
public static void Multiply(in GorgonRangeM range, decimal scalar, out GorgonRangeM result)
Parameters
Type Name Description
GorgonRangeM range

The range to multiply by.

decimal scalar

The decimal scalar value to multiply.

GorgonRangeM result

A new GorgonRangeM representing the product of the range and the scalar.

| Edit this page View Source

Shrink(GorgonRangeM, decimal)

Function to shrink a GorgonRangeM by a specific amount.

Declaration
public static GorgonRangeM Shrink(GorgonRangeM range, decimal amount)
Parameters
Type Name Description
GorgonRangeM range

A GorgonRangeM to shrink.

decimal amount

The amount to shrink the GorgonRangeM by.

Returns
Type Description
GorgonRangeM

A new GorgonRangeM value, decreased in size by amount.

| Edit this page View Source

Shrink(in GorgonRangeM, decimal, out GorgonRangeM)

Function to shrink a GorgonRangeM by a specific amount.

Declaration
public static void Shrink(in GorgonRangeM range, decimal amount, out GorgonRangeM result)
Parameters
Type Name Description
GorgonRangeM range

A GorgonRangeM to shrink.

decimal amount

The amount to shrink the GorgonRangeM by.

GorgonRangeM result

A new GorgonRangeM value, decreased in size by amount.

| Edit this page View Source

Subtract(GorgonRangeM, GorgonRangeM)

Function to subtract two GorgonRangeM ranges from each other.

Declaration
public static GorgonRangeM Subtract(GorgonRangeM left, GorgonRangeM right)
Parameters
Type Name Description
GorgonRangeM left

The left GorgonRangeM value to subtract.

GorgonRangeM right

The right GorgonRangeM value to subtract.

Returns
Type Description
GorgonRangeM

A new GorgonRangeM value representing the difference of both ranges.

| Edit this page View Source

Subtract(in GorgonRangeM, in GorgonRangeM, out GorgonRangeM)

Function to subtract two GorgonRangeM ranges from each other.

Declaration
public static void Subtract(in GorgonRangeM left, in GorgonRangeM right, out GorgonRangeM result)
Parameters
Type Name Description
GorgonRangeM left

The left GorgonRangeM value to subtract.

GorgonRangeM right

The right GorgonRangeM value to subtract.

GorgonRangeM result

A new GorgonRangeM value representing the difference of both ranges.

| Edit this page View Source

ToGorgonRange(GorgonRangeM)

Function to perform an explicit conversion from GorgonRangeM to GorgonRange.

Declaration
public static GorgonRange ToGorgonRange(GorgonRangeM range)
Parameters
Type Name Description
GorgonRangeM range

The range.

Returns
Type Description
GorgonRange

The result of the conversion.

| Edit this page View Source

ToGorgonRangeD(GorgonRangeM)

Function to perform an explicit conversion from GorgonRangeM to GorgonRangeD.

Declaration
public static GorgonRangeD ToGorgonRangeD(GorgonRangeM range)
Parameters
Type Name Description
GorgonRangeM range

The range.

Returns
Type Description
GorgonRangeD

The result of the conversion.

| Edit this page View Source

ToGorgonRangeF(GorgonRangeM)

Function to perform an explicit conversion from GorgonRangeM to GorgonRangeF.

Declaration
public static GorgonRangeF ToGorgonRangeF(GorgonRangeM range)
Parameters
Type Name Description
GorgonRangeM range

The range.

Returns
Type Description
GorgonRangeF

The result of the conversion.

| Edit this page View Source

ToString()

Returns the fully qualified type name of this instance.

Declaration
public override string ToString()
Returns
Type Description
string

A string containing a fully qualified type name.

Overrides
ValueType.ToString()

Operators

| Edit this page View Source

operator +(GorgonRangeM, GorgonRangeM)

Implements the operator +.

Declaration
public static GorgonRangeM operator +(GorgonRangeM left, GorgonRangeM right)
Parameters
Type Name Description
GorgonRangeM left

The left range.

GorgonRangeM right

The right range.

Returns
Type Description
GorgonRangeM

The result of the operator.

| Edit this page View Source

operator /(GorgonRangeM, decimal)

Implements the operator /.

Declaration
public static GorgonRangeM operator /(GorgonRangeM left, decimal scalar)
Parameters
Type Name Description
GorgonRangeM left

The left range.

decimal scalar

The right scalar value.

Returns
Type Description
GorgonRangeM

The result of the operator.

| Edit this page View Source

operator ==(GorgonRangeM, GorgonRangeM)

Implements the operator ==.

Declaration
public static bool operator ==(GorgonRangeM left, GorgonRangeM right)
Parameters
Type Name Description
GorgonRangeM left

The left.

GorgonRangeM right

The right.

Returns
Type Description
bool

The result of the operator.

| Edit this page View Source

explicit operator GorgonRange(GorgonRangeM)

Performs an explicit conversion from GorgonRangeM to GorgonRange.

Declaration
public static explicit operator GorgonRange(GorgonRangeM range)
Parameters
Type Name Description
GorgonRangeM range

The range.

Returns
Type Description
GorgonRange

The result of the conversion.

| Edit this page View Source

explicit operator GorgonRangeD(GorgonRangeM)

Performs an explicit conversion from GorgonRangeM to GorgonRangeD.

Declaration
public static explicit operator GorgonRangeD(GorgonRangeM range)
Parameters
Type Name Description
GorgonRangeM range

The range.

Returns
Type Description
GorgonRangeD

The result of the conversion.

| Edit this page View Source

explicit operator GorgonRangeF(GorgonRangeM)

Performs an explicit conversion from GorgonRangeM to GorgonRangeF.

Declaration
public static explicit operator GorgonRangeF(GorgonRangeM range)
Parameters
Type Name Description
GorgonRangeM range

The range.

Returns
Type Description
GorgonRangeF

The result of the conversion.

| Edit this page View Source

operator >(GorgonRangeM, GorgonRangeM)

Implements the operator >.

Declaration
public static bool operator >(GorgonRangeM left, GorgonRangeM right)
Parameters
Type Name Description
GorgonRangeM left

The left instance to compare.

GorgonRangeM right

The right instance to compare.

Returns
Type Description
bool

true if left is greater than right.

| Edit this page View Source

operator >=(GorgonRangeM, GorgonRangeM)

Implements the operator >=.

Declaration
public static bool operator >=(GorgonRangeM left, GorgonRangeM right)
Parameters
Type Name Description
GorgonRangeM left

The left instance to compare.

GorgonRangeM right

The right instance to compare.

Returns
Type Description
bool

true if left is greater than right.

| Edit this page View Source

operator !=(GorgonRangeM, GorgonRangeM)

Implements the operator ==.

Declaration
public static bool operator !=(GorgonRangeM left, GorgonRangeM right)
Parameters
Type Name Description
GorgonRangeM left

The left.

GorgonRangeM right

The right.

Returns
Type Description
bool

The result of the operator.

| Edit this page View Source

operator <(GorgonRangeM, GorgonRangeM)

Implements the operator >.

Declaration
public static bool operator <(GorgonRangeM left, GorgonRangeM right)
Parameters
Type Name Description
GorgonRangeM left

The left instance to compare.

GorgonRangeM right

The right instance to compare.

Returns
Type Description
bool

true if left is greater than right.

| Edit this page View Source

operator <=(GorgonRangeM, GorgonRangeM)

Implements the operator >=.

Declaration
public static bool operator <=(GorgonRangeM left, GorgonRangeM right)
Parameters
Type Name Description
GorgonRangeM left

The left instance to compare.

GorgonRangeM right

The right instance to compare.

Returns
Type Description
bool

true if left is greater than right.

| Edit this page View Source

operator *(GorgonRangeM, GorgonRangeM)

Implements the operator *.

Declaration
public static GorgonRangeM operator *(GorgonRangeM left, GorgonRangeM right)
Parameters
Type Name Description
GorgonRangeM left

The left range.

GorgonRangeM right

The right range.

Returns
Type Description
GorgonRangeM

The result of the operator.

| Edit this page View Source

operator *(GorgonRangeM, decimal)

Implements the operator *.

Declaration
public static GorgonRangeM operator *(GorgonRangeM left, decimal scalar)
Parameters
Type Name Description
GorgonRangeM left

The left range.

decimal scalar

The right scalar value.

Returns
Type Description
GorgonRangeM

The result of the operator.

| Edit this page View Source

operator *(decimal, GorgonRangeM)

Implements the operator *.

Declaration
public static GorgonRangeM operator *(decimal scalar, GorgonRangeM right)
Parameters
Type Name Description
decimal scalar

The scalar value.

GorgonRangeM right

The right scalar value.

Returns
Type Description
GorgonRangeM

The result of the operator.

| Edit this page View Source

operator -(GorgonRangeM, GorgonRangeM)

Implements the operator -.

Declaration
public static GorgonRangeM operator -(GorgonRangeM left, GorgonRangeM right)
Parameters
Type Name Description
GorgonRangeM left

The left range.

GorgonRangeM right

The right range.

Returns
Type Description
GorgonRangeM

The result of the operator.

Implements

IGorgonEquatableByRef<T>
IEquatable<T>
IComparable<T>

Extension Methods

GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author