Show / Hide Table of Contents

Class DecimalExtensions

Decimal extension methods

Inheritance
object
DecimalExtensions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: PayrollEngine.Client.Scripting
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public static class DecimalExtensions

Methods

View Source

IsWithin(decimal, decimal, decimal)

Determines whether a value is within a range

Declaration
public static bool IsWithin(this decimal value, decimal min, decimal max)
Parameters
Type Name Description
decimal value

The value to test

decimal min

The minimum value

decimal max

The maximum value

Returns
Type Description
bool

True if the specified value is within minimum and maximum

View Source

IsWithin(decimal?, decimal, decimal)

Determines whether a value is within a range

Declaration
public static bool IsWithin(this decimal? value, decimal min, decimal max)
Parameters
Type Name Description
decimal? value

The value to test

decimal min

The minimum value

decimal max

The maximum value

Returns
Type Description
bool

True if the specified value is within minimum and maximum

View Source

Round(decimal, DecimalRounding)

Rounds a decimal value wit predefined rounding type

Declaration
public static decimal Round(this decimal value, DecimalRounding rounding)
Parameters
Type Name Description
decimal value
DecimalRounding rounding

The rounding type

Returns
Type Description
decimal

The rounded value

View Source

RoundDown(decimal, decimal)

Rounds a decimal value down

Declaration
public static decimal RoundDown(this decimal value, decimal stepSize)
Parameters
Type Name Description
decimal value
decimal stepSize

The round step size

Returns
Type Description
decimal

The rounded value

View Source

RoundFifth(decimal)

Rounds a decimal value to a one-fifth (e.g. 20 cents)

Declaration
public static decimal RoundFifth(this decimal value)
Parameters
Type Name Description
decimal value
Returns
Type Description
decimal

The rounded value to one-fifth

View Source

RoundFiftieth(decimal)

Rounds a decimal value to a one-fiftieth (e.g. 2 cents)

Declaration
public static decimal RoundFiftieth(this decimal value)
Parameters
Type Name Description
decimal value
Returns
Type Description
decimal

The rounded value to one-fiftieth

View Source

RoundHalf(decimal)

Rounds a decimal value to a one-half (e.g. 50 cents)

Declaration
public static decimal RoundHalf(this decimal value)
Parameters
Type Name Description
decimal value
Returns
Type Description
decimal

The rounded value to one-half

View Source

RoundHundredth(decimal)

Rounds a decimal value to a one-hundredth (e.g. 1 cents)

Declaration
public static decimal RoundHundredth(this decimal value)
Parameters
Type Name Description
decimal value
Returns
Type Description
decimal

The rounded value to one-hundredth

View Source

RoundPartOfOne(decimal, int)

Rounds a decimal value to a one-tenth

Declaration
public static decimal RoundPartOfOne(this decimal value, int divisor)
Parameters
Type Name Description
decimal value
int divisor

The divisor factor

Returns
Type Description
decimal

The rounded value to one-tenth

View Source

RoundTenth(decimal)

Rounds a decimal value to a one-tenth (e.g. 10 cents)

Declaration
public static decimal RoundTenth(this decimal value)
Parameters
Type Name Description
decimal value
Returns
Type Description
decimal

The rounded value to one-tenth

View Source

RoundTwentieth(decimal)

Rounds a decimal value to a one-twentieth (e.g. 5 cents)

Declaration
public static decimal RoundTwentieth(this decimal value)
Parameters
Type Name Description
decimal value
Returns
Type Description
decimal

The rounded value to one-twentieth

View Source

RoundUp(decimal, decimal)

Rounds a decimal value up

Declaration
public static decimal RoundUp(this decimal value, decimal stepSize)
Parameters
Type Name Description
decimal value
decimal stepSize

The round step size

Returns
Type Description
decimal

The up-rounded value

View Source

Truncate(decimal, int)

Returns the integral digits of the specified decimal, using a step size

Declaration
public static decimal Truncate(this decimal value, int stepSize)
Parameters
Type Name Description
decimal value
int stepSize

The step size used to truncate

Returns
Type Description
decimal

The result of d rounded toward zero, to the nearest whole number within the step size

  • View Source
☀
☾
Back to top Generated by DocFX