Skip to main content

Definition

Assembly: CloudNimble.EasyAF.Core.dll Namespace: CloudNimble.EasyAF.Core Inheritance: CloudNimble.EasyAF.Core.Interval<T>

Syntax

CloudNimble.EasyAF.Core.RatioInterval<T>

Summary

Represents a ratio value that occurs at regular time intervals, enabling conversion between different time periods. This class combines a base time interval (from the Interval1` class) with a ratio value to calculate total ratio amounts across different time periods.

Remarks

<strong>Key Concepts:</strong> <strong>Method Types:</strong> <strong>Common Use Cases:</strong>

Examples

// Example: 70% conversion rate every 2 weeks
var conversionInterval = new RatioInterval&lt;double&gt;(0.70, 2, IntervalType.Weeks);

// How many 2-week intervals are there per month?
decimal intervalsPerMonth = conversionInterval.PerMonth(); // ~2.17 intervals

// What's the total conversion ratio per month?
decimal totalConversionPerMonth = conversionInterval.RatioPerMonth(); // ~1.52 (0.70 × 2.17)

// Daily breakdown
decimal totalConversionPerDay = conversionInterval.RatioPerDay(); // ~0.05 (0.70 × 0.071)

Constructors

.ctor

Initializes a new instance of the RatioInterval1` class with default values.

Syntax

public RatioInterval()

.ctor

Initializes a new instance of the RatioInterval1` class with the specified interval value and type.

Syntax

public RatioInterval(T value, CloudNimble.EasyAF.Core.IntervalType type)

Parameters

NameTypeDescription
valueTThe duration of the interval.
typeCloudNimble.EasyAF.Core.IntervalTypeThe base unit that describes what the quantity of this interval references.

.ctor

Initializes a new instance of the RatioInterval1` class with the specified ratio, interval value, and type.

Syntax

public RatioInterval(System.Decimal ratio, T value, CloudNimble.EasyAF.Core.IntervalType type)

Parameters

NameTypeDescription
ratioSystem.DecimalThe decimal ratio value that is calculated over the given interval.
valueTThe duration of the interval.
typeCloudNimble.EasyAF.Core.IntervalTypeThe base unit that describes what the quantity of this interval references.

.ctor Inherited

Inherited from CloudNimble.EasyAF.Core.Interval<T>
Creates a new instance of the Interval1` class.

Syntax

public Interval()

.ctor Inherited

Inherited from CloudNimble.EasyAF.Core.Interval<T>
Creates a new instance of the Interval1` class.

Syntax

public Interval(T value, CloudNimble.EasyAF.Core.IntervalType type)

Parameters

NameTypeDescription
valueTThe duration of the interval.
typeCloudNimble.EasyAF.Core.IntervalTypeThe base unit that describes what the quantity of this Interval references.

.ctor Inherited

Inherited from object

Syntax

public Object()

Properties

Ratio

Gets or sets the decimal ratio value that is calculated over the given interval. Can represent a ratio, rate, or other decimal value per time period.

Syntax

public System.Decimal Ratio { get; set; }

Property Value

Type: System.Decimal

Type Inherited

Inherited from CloudNimble.EasyAF.Core.Interval<T>
The base unit that describes what the quantity of this Interval references.

Syntax

public CloudNimble.EasyAF.Core.IntervalType Type { get; set; }

Property Value

Type: CloudNimble.EasyAF.Core.IntervalType

Value Inherited

Inherited from CloudNimble.EasyAF.Core.Interval<T>
The duration of the Interval.

Syntax

public T Value { get; set; }

Property Value

Type: T

Methods

Equals Inherited Virtual

Inherited from object

Syntax

public virtual bool Equals(object obj)

Parameters

NameTypeDescription
objobject?-

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

public static bool Equals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

protected internal object MemberwiseClone()

Returns

Type: object

PerDay Inherited Virtual

Inherited from CloudNimble.EasyAF.Core.Interval<T>
Given this Interval1` instance, calculates how many occurrences will happen per day.

Syntax

public virtual System.Decimal PerDay()

Returns

Type: System.Decimal The number of occurrences per day as a decimal value.

Exceptions

ExceptionDescription
InvalidCastExceptionThrown if T is not convertible to a Decimal.

PerDay Inherited Virtual

Inherited from CloudNimble.EasyAF.Core.Interval<T>
Given this Interval1` instance and a quantity, calculates the total output per day.

Syntax

public virtual System.Decimal PerDay(System.Decimal quantity)

Parameters

NameTypeDescription
quantitySystem.DecimalThe quantity to multiply by the interval frequency.

Returns

Type: System.Decimal The total output per day as a decimal value.

Exceptions

ExceptionDescription
InvalidCastExceptionThrown if T is not convertible to a Decimal.

Examples

// Widget production: 1 widget every 1.5 hours, total from 100 units of material per day
var production = new Interval&lt;double&gt;(1.5, IntervalType.Hours);
decimal totalPerDay = production.PerDay(100); // 1600 widgets per day (16 * 100)

PerHour Inherited Virtual

Inherited from CloudNimble.EasyAF.Core.Interval<T>
Given this Interval1` instance, calculates how many occurrences will happen per hour.

Syntax

public virtual System.Decimal PerHour()

Returns

Type: System.Decimal The number of occurrences per hour as a decimal value.

Exceptions

ExceptionDescription
InvalidCastExceptionThrown if T is not convertible to a Decimal.

PerHour Inherited Virtual

Inherited from CloudNimble.EasyAF.Core.Interval<T>
Given this Interval1` instance and a quantity, calculates the total output per hour.

Syntax

public virtual System.Decimal PerHour(System.Decimal quantity)

Parameters

NameTypeDescription
quantitySystem.DecimalThe quantity to multiply by the interval frequency.

Returns

Type: System.Decimal The total output per hour as a decimal value.

Exceptions

ExceptionDescription
InvalidCastExceptionThrown if T is not convertible to a Decimal.

Examples

// Widget production: 1 widget every 1.5 hours, total from 100 units of material per hour
var production = new Interval&lt;double&gt;(1.5, IntervalType.Hours);
decimal totalPerHour = production.PerHour(100); // 66.67 widgets per hour (1/1.5 * 100)

PerMinute Inherited Virtual

Inherited from CloudNimble.EasyAF.Core.Interval<T>
Given this Interval1` instance, calculates how many occurrences will happen per minute.

Syntax

public virtual System.Decimal PerMinute()

Returns

Type: System.Decimal The number of occurrences per minute as a decimal value.

Exceptions

ExceptionDescription
InvalidCastExceptionThrown if T is not convertible to a Decimal.

Remarks

If you need this as a whole number, wrap the result in Decimal).

PerMinute Inherited Virtual

Inherited from CloudNimble.EasyAF.Core.Interval<T>
Given this Interval1` instance and a quantity, calculates the total output per minute.

Syntax

public virtual System.Decimal PerMinute(System.Decimal quantity)

Parameters

NameTypeDescription
quantitySystem.DecimalThe quantity to multiply by the interval frequency.

Returns

Type: System.Decimal The total output per minute as a decimal value.

Exceptions

ExceptionDescription
InvalidCastExceptionThrown if T is not convertible to a Decimal.

Examples

// Widget production: 1 widget every 90 minutes, total from 100 units of material per minute
var production = new Interval&lt;int&gt;(90, IntervalType.Minutes);
decimal totalPerMinute = production.PerMinute(100); // 1.11 widgets per minute (1/90 * 100)

PerMonth Inherited Virtual

Inherited from CloudNimble.EasyAF.Core.Interval<T>
Given this Interval1` instance, calculates how many occurrences will happen per month.

Syntax

public virtual System.Decimal PerMonth()

Returns

Type: System.Decimal The number of occurrences per month as a decimal value.

Exceptions

ExceptionDescription
InvalidCastExceptionThrown if T is not convertible to a Decimal.

PerMonth Inherited Virtual

Inherited from CloudNimble.EasyAF.Core.Interval<T>
Given this Interval1` instance and a quantity, calculates the total output per month.

Syntax

public virtual System.Decimal PerMonth(System.Decimal quantity)

Parameters

NameTypeDescription
quantitySystem.DecimalThe quantity to multiply by the interval frequency.

Returns

Type: System.Decimal The total output per month as a decimal value.

Exceptions

ExceptionDescription
InvalidCastExceptionThrown if T is not convertible to a Decimal.

Examples

// Widget production: 1 widget every 3 days, total from 200 units of material per month
var production = new Interval&lt;int&gt;(3, IntervalType.Days);
decimal totalPerMonth = production.PerMonth(200); // 2000 widgets per month (10 * 200)

PerWeek Inherited Virtual

Inherited from CloudNimble.EasyAF.Core.Interval<T>
Given this Interval1` instance, calculates how many occurrences will happen per week.

Syntax

public virtual System.Decimal PerWeek()

Returns

Type: System.Decimal The number of occurrences per week as a decimal value.

Exceptions

ExceptionDescription
InvalidCastExceptionThrown if T is not convertible to a Decimal.

PerWeek Inherited Virtual

Inherited from CloudNimble.EasyAF.Core.Interval<T>
Given this Interval1` instance and a quantity, calculates the total output per week.

Syntax

public virtual System.Decimal PerWeek(System.Decimal quantity)

Parameters

NameTypeDescription
quantitySystem.DecimalThe quantity to multiply by the interval frequency.

Returns

Type: System.Decimal The total output per week as a decimal value.

Exceptions

ExceptionDescription
InvalidCastExceptionThrown if T is not convertible to a Decimal.

Examples

// Widget production: 1 widget every 2 days, total from 50 units of material per week
var production = new Interval&lt;int&gt;(2, IntervalType.Days);
decimal totalPerWeek = production.PerWeek(50); // 175 widgets per week (3.5 * 50)

PerYear Inherited Virtual

Inherited from CloudNimble.EasyAF.Core.Interval<T>
Given this Interval1` instance, calculates how many occurrences will happen per year.

Syntax

public virtual System.Decimal PerYear()

Returns

Type: System.Decimal The number of occurrences per year as a decimal value.

Exceptions

ExceptionDescription
InvalidCastExceptionThrown if T is not convertible to a Decimal.

PerYear Inherited Virtual

Inherited from CloudNimble.EasyAF.Core.Interval<T>
Given this Interval1` instance and a quantity, calculates the total output per year.

Syntax

public virtual System.Decimal PerYear(System.Decimal quantity)

Parameters

NameTypeDescription
quantitySystem.DecimalThe quantity to multiply by the interval frequency.

Returns

Type: System.Decimal The total output per year as a decimal value.

Exceptions

ExceptionDescription
InvalidCastExceptionThrown if T is not convertible to a Decimal.

Examples

// Widget production: 1 widget every 1 week, total from 500 units of material per year
var production = new Interval&lt;int&gt;(1, IntervalType.Weeks);
decimal totalPerYear = production.PerYear(500); // 26071 widgets per year (52.14 * 500)

RatioPerDay

Calculates the total ratio value per day based on the interval and ratio. This method multiplies the interval frequency (how many intervals occur per day) by the ratio value.

Syntax

public System.Decimal RatioPerDay()

Returns

Type: System.Decimal The total ratio value per day as a decimal.

Examples

// 0.75 ratio every 6 hours = 0.75 * 4 = 3.0 ratio per day
var interval = new RatioInterval&lt;double&gt;(0.75, 6, IntervalType.Hours);
decimal ratioPerDay = interval.RatioPerDay();

RatioPerDay

Calculates the total ratio value per day for a given quantity based on the interval and ratio.

Syntax

public System.Decimal RatioPerDay(System.Decimal quantity)

Parameters

NameTypeDescription
quantitySystem.DecimalThe quantity to apply the ratio calculation to.

Returns

Type: System.Decimal The total ratio value per day as a decimal.

Examples

// 70% conversion every month, total conversions from 30 customers per day
var conversion = new RatioInterval&lt;double&gt;(0.70m, 1, IntervalType.Months);
decimal conversionsPerDay = conversion.RatioPerDay(30); // ~0.69 conversions per day

RatioPerHour

Calculates the total ratio value per hour based on the interval and ratio. This method multiplies the interval frequency (how many intervals occur per hour) by the ratio value.

Syntax

public System.Decimal RatioPerHour()

Returns

Type: System.Decimal The total ratio value per hour as a decimal.

Examples

// 0.7 ratio every 1.5 hours = 0.7 * (60/90) = 0.467 ratio per hour
var interval = new RatioInterval&lt;double&gt;(0.7, 1.5, IntervalType.Hours);
decimal ratioPerHour = interval.RatioPerHour();

RatioPerHour

Calculates the total ratio value per hour for a given quantity based on the interval and ratio.

Syntax

public System.Decimal RatioPerHour(System.Decimal quantity)

Parameters

NameTypeDescription
quantitySystem.DecimalThe quantity to apply the ratio calculation to.

Returns

Type: System.Decimal The total ratio value per hour as a decimal.

Examples

// 70% conversion every 1.5 hours, total conversions from 100 leads per hour
var conversion = new RatioInterval&lt;double&gt;(0.70m, 1.5, IntervalType.Hours);
decimal conversionsPerHour = conversion.RatioPerHour(100); // ~46.67 conversions per hour

RatioPerMinute

Calculates the total ratio value per minute based on the interval and ratio. This method multiplies the interval frequency (how many intervals occur per minute) by the ratio value.

Syntax

public System.Decimal RatioPerMinute()

Returns

Type: System.Decimal The total ratio value per minute as a decimal.

Examples

// 0.5 ratio every 2 hours = 0.5 * (60/120) = 0.25 ratio per minute
var interval = new RatioInterval&lt;double&gt;(0.5, 2, IntervalType.Hours);
decimal ratioPerMinute = interval.RatioPerMinute();

RatioPerMinute

Calculates the total ratio value per minute for a given quantity based on the interval and ratio.

Syntax

public System.Decimal RatioPerMinute(System.Decimal quantity)

Parameters

NameTypeDescription
quantitySystem.DecimalThe quantity to apply the ratio calculation to.

Returns

Type: System.Decimal The total ratio value per minute as a decimal.

Examples

// 70% conversion every month, total conversions from 1000 leads per minute
var conversion = new RatioInterval&lt;double&gt;(0.70m, 1, IntervalType.Months);
decimal conversionsPerMinute = conversion.RatioPerMinute(1000); // ~0.016 conversions per minute

RatioPerMonth

Calculates the total ratio value per month based on the interval and ratio. This method multiplies the interval frequency (how many intervals occur per month) by the ratio value.

Syntax

public System.Decimal RatioPerMonth()

Returns

Type: System.Decimal The total ratio value per month as a decimal.

Examples

// 0.6 ratio every 1 week = 0.6 * 4.34 = 2.6 ratio per month
var interval = new RatioInterval&lt;double&gt;(0.6, 1, IntervalType.Weeks);
decimal ratioPerMonth = interval.RatioPerMonth();

RatioPerMonth

Calculates the total ratio value per month for a given quantity based on the interval and ratio.

Syntax

public System.Decimal RatioPerMonth(System.Decimal quantity)

Parameters

NameTypeDescription
quantitySystem.DecimalThe quantity to apply the ratio calculation to.

Returns

Type: System.Decimal The total ratio value per month as a decimal.

Examples

// 60% conversion every week, total conversions from 100 leads per month
var conversion = new RatioInterval&lt;double&gt;(0.60m, 1, IntervalType.Weeks);
decimal conversionsPerMonth = conversion.RatioPerMonth(100); // 260 conversions per month

RatioPerWeek

Calculates the total ratio value per week based on the interval and ratio. This method multiplies the interval frequency (how many intervals occur per week) by the ratio value.

Syntax

public System.Decimal RatioPerWeek()

Returns

Type: System.Decimal The total ratio value per week as a decimal.

Examples

// 0.8 ratio every 2 days = 0.8 * 3.5 = 2.8 ratio per week
var interval = new RatioInterval&lt;double&gt;(0.8, 2, IntervalType.Days);
decimal ratioPerWeek = interval.RatioPerWeek();

RatioPerWeek

Calculates the total ratio value per week for a given quantity based on the interval and ratio.

Syntax

public System.Decimal RatioPerWeek(System.Decimal quantity)

Parameters

NameTypeDescription
quantitySystem.DecimalThe quantity to apply the ratio calculation to.

Returns

Type: System.Decimal The total ratio value per week as a decimal.

Examples

// 80% conversion every 2 days, total conversions from 50 leads per week
var conversion = new RatioInterval&lt;double&gt;(0.80m, 2, IntervalType.Days);
decimal conversionsPerWeek = conversion.RatioPerWeek(50); // 140 conversions per week

RatioPerYear

Calculates the total ratio value per year based on the interval and ratio. This method multiplies the interval frequency (how many intervals occur per year) by the ratio value.

Syntax

public System.Decimal RatioPerYear()

Returns

Type: System.Decimal The total ratio value per year as a decimal.

Examples

// 0.9 ratio every 3 months = 0.9 * 4 = 3.6 ratio per year
var interval = new RatioInterval&lt;double&gt;(0.9, 3, IntervalType.Months);
decimal ratioPerYear = interval.RatioPerYear();

RatioPerYear

Calculates the total ratio value per year for a given quantity based on the interval and ratio.

Syntax

public System.Decimal RatioPerYear(System.Decimal quantity)

Parameters

NameTypeDescription
quantitySystem.DecimalThe quantity to apply the ratio calculation to.

Returns

Type: System.Decimal The total ratio value per year as a decimal.

Examples

// 90% conversion every 3 months, total conversions from 1000 leads per year
var conversion = new RatioInterval&lt;double&gt;(0.90m, 3, IntervalType.Months);
decimal conversionsPerYear = conversion.RatioPerYear(1000); // 3600 conversions per year

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

ToString Override

Inherited from CloudNimble.EasyAF.Core.Interval<T>

Syntax

public override string ToString()

Returns

Type: string

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?