Show / Hide Table of Contents

Class DecimalEx

Class containing some extension methods for System.Int32.

Inheritance
System.Object
DecimalEx
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace:Extend
Assembly:Extend.dll
Syntax
public static class DecimalEx

Methods

| Improve this Doc View Source

PercentageOf(Decimal, Decimal)

Gets the specified percentage of the number.

Declaration
public static decimal PercentageOf(this decimal number, decimal percent)
Parameters
Type Name Description
System.Decimal number

The number.

System.Decimal percent

The percent.

Returns
Type Description
System.Decimal

Returns the specified percentage of the number

| Improve this Doc View Source

PercentageOf(Decimal, Int32)

Gets the specified percentage of the number.

Declaration
public static decimal PercentageOf(this decimal number, int percent)
Parameters
Type Name Description
System.Decimal number

The number.

System.Int32 percent

The percent.

Returns
Type Description
System.Decimal

Returns the specified percentage of the number

| Improve this Doc View Source

PercentageOf(Decimal, Int64)

Gets the specified percentage of the number.

Declaration
public static decimal PercentageOf(this decimal number, long percent)
Parameters
Type Name Description
System.Decimal number

The number.

System.Int64 percent

The percent.

Returns
Type Description
System.Decimal

Returns the specified percentage of the number

| Improve this Doc View Source

PercentOf(Decimal, Decimal)

Gets the percentage of the number.

Declaration
public static decimal PercentOf(this decimal number, decimal total)
Parameters
Type Name Description
System.Decimal number

The number.

System.Decimal total

The total value.

Returns
Type Description
System.Decimal

Returns the percentage of the number.

Exceptions
Type Condition
System.DivideByZeroException

The number must be greater than zero.

| Improve this Doc View Source

PercentOf(Decimal, Int32)

Gets the percentage of the number.

Declaration
public static decimal PercentOf(this decimal number, int total)
Parameters
Type Name Description
System.Decimal number

The number.

System.Int32 total

The total value.

Returns
Type Description
System.Decimal

Returns the percentage of the number.

Exceptions
Type Condition
System.DivideByZeroException

The number must be greater than zero.

| Improve this Doc View Source

PercentOf(Decimal, Int64)

Gets the percentage of the number.

Declaration
public static decimal PercentOf(this decimal number, long total)
Parameters
Type Name Description
System.Decimal number

The number.

System.Int64 total

The total value.

Returns
Type Description
System.Decimal

Returns the percentage of the number.

Exceptions
Type Condition
System.DivideByZeroException

The number must be greater than zero.

| Improve this Doc View Source

Sum(Decimal, Decimal[])

Computes the sum of a sequence of the given values.

Declaration
public static decimal Sum(this decimal value, params decimal[] values)
Parameters
Type Name Description
System.Decimal value

The first value.

System.Decimal[] values

The other values.

Returns
Type Description
System.Decimal

Returns the sum of the values.

Exceptions
Type Condition
System.OverflowException

The sum is larger than System.Decimal.MaxValue

System.ArgumentNullException

values can not be null.

| Improve this Doc View Source

Sum(Nullable<Decimal>, Nullable<Decimal>[])

Computes the sum of a sequence of the given values.

Declaration
public static decimal ? Sum(this decimal ? value, params decimal ? [] values)
Parameters
Type Name Description
System.Nullable<T><System.Decimal> value

The first value.

System.Nullable<T><System.Decimal>[] values

The other values.

Returns
Type Description
System.Nullable<T><System.Decimal>

Returns the sum of the values.

Exceptions
Type Condition
System.OverflowException

The sum is larger than System.Decimal.MaxValue

System.ArgumentNullException

values can not be null.

| Improve this Doc View Source

Sum<TSource>(TSource, Func<TSource, Decimal>, TSource[])

Computes the sum of the sequence of System.Decimal values that are obtained by invoking a transform function on each element of the input sequence.

Declaration
public static decimal Sum<TSource>(this TSource value, Func<TSource, decimal> selector, params TSource[] values)
Parameters
Type Name Description
TSource value

The first value.

System.Func<T, TResult><TSource, System.Decimal> selector

A transform function to apply to each element.

TSource[] values

The other values.

Returns
Type Description
System.Decimal

Returns the sum of the projected values.

Type Parameters
Name Description
TSource The type of the source values.
Exceptions
Type Condition
System.OverflowException

The sum is larger than System.Decimal.MaxValue

System.ArgumentNullException

selector can not be null.

| Improve this Doc View Source

Sum<TSource>(TSource, Func<TSource, Nullable<Decimal>>, TSource[])

Computes the sum of the sequence of nullable System.Decimal values that are obtained by invoking a transform function on each element of the input sequence.

Declaration
public static decimal ? Sum<TSource>(this TSource value, Func<TSource, decimal ? > selector, params TSource[] values)
Parameters
Type Name Description
TSource value

The first value.

System.Func<T, TResult><TSource, System.Nullable<T><System.Decimal>> selector

A transform function to apply to each element.

TSource[] values

The other values.

Returns
Type Description
System.Nullable<T><System.Decimal>

Returns the sum of the projected values.

Type Parameters
Name Description
TSource The type of the source values.
Exceptions
Type Condition
System.OverflowException

The sum is larger than System.Decimal.MaxValue

System.ArgumentNullException

selector can not be null.

  • Improve this Doc
  • View Source
Back to top Copyright © 2015-2016 Microsoft
Generated by DocFX