Show / Hide Table of Contents

Class DoubleEx

Class containing some extension methods for System.Double.

Inheritance
System.Object
DoubleEx
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 DoubleEx

Methods

| Improve this Doc View Source

IsInfinity(Double)

Returns whether the specified number evaluates to negative or positive infinity.

Declaration
public static bool IsInfinity(this double value)
Parameters
Type Name Description
System.Double value

The double to check.

Returns
Type Description
System.Boolean

Returns true if the given double is infinity, otherwise false.

| Improve this Doc View Source

IsNaN(Double)

Returns whether the specified value is not a number.

Declaration
public static bool IsNaN(this double value)
Parameters
Type Name Description
System.Double value

The double to check.

Returns
Type Description
System.Boolean

Returns true if the value is not a number, otherwise false.

| Improve this Doc View Source

IsNegativeInfinity(Double)

Returns whether the specified number evaluates to negative infinity.

Declaration
public static bool IsNegativeInfinity(this double value)
Parameters
Type Name Description
System.Double value

The double to check.

Returns
Type Description
System.Boolean

Returns true if the given double is negative infinity, otherwise false.

| Improve this Doc View Source

IsPositiveInfinity(Double)

Returns whether the specified number evaluates to positive infinity.

Declaration
public static bool IsPositiveInfinity(this double value)
Parameters
Type Name Description
System.Double value

The double to check.

Returns
Type Description
System.Boolean

Returns true if the given double is positive infinity, otherwise false.

| Improve this Doc View Source

PercentageOf(Double, Double)

Gets the specified percentage of the number.

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

The number.

System.Double percent

The percent.

Returns
Type Description
System.Double

Returns the specified percentage of the number

| Improve this Doc View Source

PercentageOf(Double, Int32)

Gets the specified percentage of the number.

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

The number.

System.Int32 percent

The percent.

Returns
Type Description
System.Double

Returns the specified percentage of the number

| Improve this Doc View Source

PercentageOf(Double, Int64)

Gets the specified percentage of the number.

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

The number.

System.Int64 percent

The percent.

Returns
Type Description
System.Double

Returns the specified percentage of the number

| Improve this Doc View Source

PercentOf(Double, Double)

Gets the percentage of the number.

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

The number.

System.Double total

The total value.

Returns
Type Description
System.Double

Returns the percentage of the number.

Exceptions
Type Condition
System.DivideByZeroException

The number must be greater than zero.

| Improve this Doc View Source

PercentOf(Double, Int32)

Gets the percentage of the number.

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

The number.

System.Int32 total

The total value.

Returns
Type Description
System.Double

Returns the percentage of the number.

Exceptions
Type Condition
System.DivideByZeroException

The number must be greater than zero.

| Improve this Doc View Source

PercentOf(Double, Int64)

Gets the percentage of the number.

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

The number.

System.Int64 total

The total value.

Returns
Type Description
System.Double

Returns the percentage of the number.

Exceptions
Type Condition
System.DivideByZeroException

The number must be greater than zero.

| Improve this Doc View Source

Sum(Double, Double[])

Computes the sum of a sequence of the given values.

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

The first value.

System.Double[] values

The other values.

Returns
Type Description
System.Double

Returns the sum of the values.

Exceptions
Type Condition
System.OverflowException

The sum is larger than System.Double.MaxValue

System.ArgumentNullException

values can not be null.

| Improve this Doc View Source

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

Computes the sum of a sequence of the given values.

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

The first value.

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

The other values.

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

Returns the sum of the values.

Exceptions
Type Condition
System.OverflowException

The sum is larger than System.Double.MaxValue

System.ArgumentNullException

values can not be null.

| Improve this Doc View Source

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

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

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

The first value.

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

A transform function to apply to each element.

TSource[] values

The other values.

Returns
Type Description
System.Double

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.Double.MaxValue

System.ArgumentNullException

selector can not be null.

| Improve this Doc View Source

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

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

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

The first value.

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

A transform function to apply to each element.

TSource[] values

The other values.

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

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.Double.MaxValue

System.ArgumentNullException

selector can not be null.

| Improve this Doc View Source

ToDays(Double)

Returns the given Double value as day.

Declaration
public static TimeSpan ToDays(this double value)
Parameters
Type Name Description
System.Double value

The Double value.

Returns
Type Description
System.TimeSpan

Returns the given Double value as days.

| Improve this Doc View Source

ToHours(Double)

Returns the given Double value as hours.

Declaration
public static TimeSpan ToHours(this double value)
Parameters
Type Name Description
System.Double value

The Double value.

Returns
Type Description
System.TimeSpan

Returns the given Double value as hours.

| Improve this Doc View Source

ToMilliseconds(Double)

Returns the given Double value as milliseconds.

Declaration
public static TimeSpan ToMilliseconds(this double value)
Parameters
Type Name Description
System.Double value

The Double value.

Returns
Type Description
System.TimeSpan

Returns the given Double value as milliseconds.

| Improve this Doc View Source

ToMinutes(Double)

Returns the given Double value as minutes.

Declaration
public static TimeSpan ToMinutes(this double value)
Parameters
Type Name Description
System.Double value

The Double value.

Returns
Type Description
System.TimeSpan

Returns the given Double value as minutes.

| Improve this Doc View Source

ToSeconds(Double)

Returns the given Double value as seconds.

Declaration
public static TimeSpan ToSeconds(this double value)
Parameters
Type Name Description
System.Double value

The Double value.

Returns
Type Description
System.TimeSpan

Returns the given Double value as seconds.

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