Definition
Assembly: CloudNimble.EasyAF.Core.dll
Namespace: CloudNimble.EasyAF.Core
Inheritance: CloudNimble.EasyAF.Core.Interval<T>
Syntax
CloudNimble . EasyAF . Core . PercentageInterval < T >
Summary
Represents a percentage rate 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 percentage rate to calculate
total percentage amounts across different time periods.
<strong>Key Concepts:</strong>
<strong>Method Types:</strong>
<strong>Common Use Cases:</strong>
Examples
// Example: 2.5% interest rate every quarter (3 months)
var interestInterval = new PercentageInterval & lt ; double & gt ;( 0.025 , 3 , IntervalType . Months );
// How many quarters are there per year?
decimal quartersPerYear = interestInterval . PerYear (); // 4 quarters
// What's the total interest rate per year?
decimal totalInterestPerYear = interestInterval . RatePerYear (); // 0.10 (0.025 × 4)
// Monthly breakdown
decimal totalInterestPerMonth = interestInterval . RatePerMonth (); // ~0.0083 (0.025 × 0.33)
Constructors
.ctor
Initializes a new instance of the PercentageInterval1` class with default values.
Syntax
public PercentageInterval ()
.ctor
Initializes a new instance of the PercentageInterval1` class with the specified interval value and type.
Syntax
public PercentageInterval ( T value , CloudNimble . EasyAF . Core . IntervalType type )
Parameters
Name Type Description 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 PercentageInterval1` class with the specified rate, interval value, and type.
Syntax
public PercentageInterval ( System . Decimal money , T value , CloudNimble . EasyAF . Core . IntervalType type )
Parameters
Name Type Description moneySystem.DecimalThe percentage rate 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
.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
Name Type Description valueTThe duration of the interval. typeCloudNimble.EasyAF.Core.IntervalTypeThe base unit that describes what the quantity of this Interval references.
.ctor Inherited
Syntax
Properties
Rate
The amount of money represented by the given IntervalType
Syntax
public System . Decimal Rate { 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
Syntax
public virtual bool Equals ( object obj )
Parameters
Name Type Description objobject?-
Returns
Type: bool
Equals Inherited
Syntax
public static bool Equals ( object objA , object objB )
Parameters
Name Type Description objAobject?- objBobject?-
Returns
Type: bool
GetHashCode Inherited Virtual
Syntax
public virtual int GetHashCode ()
Returns
Type: int
GetType Inherited
Syntax
public System . Type GetType ()
Returns
Type: System.Type
MemberwiseClone Inherited
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
Exception Description 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
Name Type Description quantitySystem.DecimalThe quantity to multiply by the interval frequency.
Returns
Type: System.Decimal
The total output per day as a decimal value.
Exceptions
Exception Description 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
Exception Description 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
Name Type Description quantitySystem.DecimalThe quantity to multiply by the interval frequency.
Returns
Type: System.Decimal
The total output per hour as a decimal value.
Exceptions
Exception Description 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
Exception Description InvalidCastExceptionThrown if T is not convertible to a Decimal .
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
Name Type Description quantitySystem.DecimalThe quantity to multiply by the interval frequency.
Returns
Type: System.Decimal
The total output per minute as a decimal value.
Exceptions
Exception Description 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
Exception Description 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
Name Type Description quantitySystem.DecimalThe quantity to multiply by the interval frequency.
Returns
Type: System.Decimal
The total output per month as a decimal value.
Exceptions
Exception Description 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
Exception Description 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
Name Type Description quantitySystem.DecimalThe quantity to multiply by the interval frequency.
Returns
Type: System.Decimal
The total output per week as a decimal value.
Exceptions
Exception Description 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
Exception Description 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
Name Type Description quantitySystem.DecimalThe quantity to multiply by the interval frequency.
Returns
Type: System.Decimal
The total output per year as a decimal value.
Exceptions
Exception Description 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)
RatePerDay
Calculates the total percentage rate per day based on the interval and rate.
This method multiplies the interval frequency (how many intervals occur per day) by the rate value.
Syntax
public System . Decimal RatePerDay ()
Returns
Type: System.Decimal
The total rate value per day as a decimal.
Examples
// 8% rate every 6 hours = 0.08 * 4 = 0.32 rate per day
var interval = new PercentageInterval & lt ; double & gt ;( 0.08 , 6 , IntervalType . Hours );
decimal ratePerDay = interval . RatePerDay ();
RatePerDay
Calculates the total percentage rate per day for a given principal amount based on the interval and rate.
Syntax
public System . Decimal RatePerDay ( System . Decimal principal )
Parameters
Name Type Description principalSystem.DecimalThe principal amount to apply the percentage rate to.
Returns
Type: System.Decimal
The total rate value per day as a decimal.
Examples
// 8% growth rate every 6 hours, growth on $25,000 investment per day
var growth = new PercentageInterval & lt ; double & gt ;( 0.08m , 6 , IntervalType . Hours );
decimal growthPerDay = growth . RatePerDay ( 25000 ); // $8,000 per day
RatePerHour
Calculates the total percentage rate per hour based on the interval and rate.
This method multiplies the interval frequency (how many intervals occur per hour) by the rate value.
Syntax
public System . Decimal RatePerHour ()
Returns
Type: System.Decimal
The total rate value per hour as a decimal.
Examples
// 12% rate every 3 hours = 0.12 * (60/180) = 0.04 rate per hour
var interval = new PercentageInterval & lt ; double & gt ;( 0.12 , 3 , IntervalType . Hours );
decimal ratePerHour = interval . RatePerHour ();
RatePerHour
Calculates the total percentage rate per hour for a given principal amount based on the interval and rate.
Syntax
public System . Decimal RatePerHour ( System . Decimal principal )
Parameters
Name Type Description principalSystem.DecimalThe principal amount to apply the percentage rate to.
Returns
Type: System.Decimal
The total rate value per hour as a decimal.
Examples
// 12% growth rate every 3 hours, growth on $10,000 investment per hour
var growth = new PercentageInterval & lt ; double & gt ;( 0.12m , 3 , IntervalType . Hours );
decimal growthPerHour = growth . RatePerHour ( 10000 ); // $400 per hour
RatePerMinute
Calculates the total percentage rate per minute based on the interval and rate.
This method multiplies the interval frequency (how many intervals occur per minute) by the rate value.
Syntax
public System . Decimal RatePerMinute ()
Returns
Type: System.Decimal
The total rate value per minute as a decimal.
Examples
// 5% rate every 2 hours = 0.05 * (60/120) = 0.025 rate per minute
var interval = new PercentageInterval & lt ; double & gt ;( 0.05 , 2 , IntervalType . Hours );
decimal ratePerMinute = interval . RatePerMinute ();
RatePerMinute
Calculates the total percentage rate per minute for a given principal amount based on the interval and rate.
Syntax
public System . Decimal RatePerMinute ( System . Decimal principal )
Parameters
Name Type Description principalSystem.DecimalThe principal amount to apply the percentage rate to.
Returns
Type: System.Decimal
The total rate value per minute as a decimal.
Examples
// 2.5% interest every quarter, interest on $50,000 per minute
var interest = new PercentageInterval & lt ; double & gt ;( 0.025m , 3 , IntervalType . Months );
decimal interestPerMinute = interest . RatePerMinute ( 50000 ); // ~$0.19 per minute
RatePerMonth
Calculates the total percentage rate per month based on the interval and rate.
This method multiplies the interval frequency (how many intervals occur per month) by the rate value.
Syntax
public System . Decimal RatePerMonth ()
Returns
Type: System.Decimal
The total rate value per month as a decimal.
Examples
// 10% rate every 1 week = 0.10 * 4.34 = 0.434 rate per month
var interval = new PercentageInterval & lt ; double & gt ;( 0.10 , 1 , IntervalType . Weeks );
decimal ratePerMonth = interval . RatePerMonth ();
RatePerMonth
Calculates the total percentage rate per month for a given principal amount based on the interval and rate.
Syntax
public System . Decimal RatePerMonth ( System . Decimal principal )
Parameters
Name Type Description principalSystem.DecimalThe principal amount to apply the percentage rate to.
Returns
Type: System.Decimal
The total rate value per month as a decimal.
Examples
// 10% growth rate every week, growth on $5,000 investment per month
var growth = new PercentageInterval & lt ; double & gt ;( 0.10m , 1 , IntervalType . Weeks );
decimal growthPerMonth = growth . RatePerMonth ( 5000 ); // $2,170 per month
RatePerWeek
Calculates the total percentage rate per week based on the interval and rate.
This method multiplies the interval frequency (how many intervals occur per week) by the rate value.
Syntax
public System . Decimal RatePerWeek ()
Returns
Type: System.Decimal
The total rate value per week as a decimal.
Examples
// 15% rate every 2 days = 0.15 * 3.5 = 0.525 rate per week
var interval = new PercentageInterval & lt ; double & gt ;( 0.15 , 2 , IntervalType . Days );
decimal ratePerWeek = interval . RatePerWeek ();
RatePerWeek
Calculates the total percentage rate per week for a given principal amount based on the interval and rate.
Syntax
public System . Decimal RatePerWeek ( System . Decimal principal )
Parameters
Name Type Description principalSystem.DecimalThe principal amount to apply the percentage rate to.
Returns
Type: System.Decimal
The total rate value per week as a decimal.
Examples
// 15% discount rate every 2 days, discount on $1,000 purchase per week
var discount = new PercentageInterval & lt ; double & gt ;( 0.15m , 2 , IntervalType . Days );
decimal discountPerWeek = discount . RatePerWeek ( 1000 ); // $525 per week
RatePerYear
Calculates the total percentage rate per year based on the interval and rate.
This method multiplies the interval frequency (how many intervals occur per year) by the rate value.
Syntax
public System . Decimal RatePerYear ()
Returns
Type: System.Decimal
The total rate value per year as a decimal.
Examples
// 20% rate every 3 months = 0.20 * 4 = 0.80 rate per year
var interval = new PercentageInterval & lt ; double & gt ;( 0.20 , 3 , IntervalType . Months );
decimal ratePerYear = interval . RatePerYear ();
RatePerYear
Calculates the total percentage rate per year for a given principal amount based on the interval and rate.
Syntax
public System . Decimal RatePerYear ( System . Decimal principal )
Parameters
Name Type Description principalSystem.DecimalThe principal amount to apply the percentage rate to.
Returns
Type: System.Decimal
The total rate value per year as a decimal.
Examples
// 20% annual return every 3 months, return on $100,000 investment per year
var returns = new PercentageInterval & lt ; double & gt ;( 0.20m , 3 , IntervalType . Months );
decimal returnsPerYear = returns . RatePerYear ( 100000 ); // $80,000 per year
ReferenceEquals Inherited
Syntax
public static bool ReferenceEquals ( object objA , object objB )
Parameters
Name Type Description 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
Syntax
public virtual string ToString ()
Returns
Type: string?