Show / Hide Table of Contents

    Class NumberUtility

    This utility class is designed to make number operations easier to work with.

    Inheritance
    System.Object
    NumberUtility
    Namespace: Cuemon
    Assembly: Cuemon.Core.dll
    Syntax
    public static class NumberUtility

    Methods

    | Improve this Doc

    BytesToGigabytes(Int64)

    Converts the specified bytes to its equivalent representation in gigabytes.

    Declaration
    public static double BytesToGigabytes(long bytes)
    Parameters
    Type Name Description
    System.Int64 bytes

    The bytes to be converted.

    Returns
    Type Description
    System.Double

    A gigabyte representation equivalent to the specified bytes.

    | Improve this Doc

    BytesToKilobytes(Int64)

    Converts the specified bytes to its equivalent representation in kilobytes.

    Declaration
    public static double BytesToKilobytes(long bytes)
    Parameters
    Type Name Description
    System.Int64 bytes

    The bytes to be converted.

    Returns
    Type Description
    System.Double

    A kilobyte representation equivalent to the specified bytes.

    | Improve this Doc

    BytesToMegabytes(Int64)

    Converts the specified bytes to its equivalent representation in megabytes.

    Declaration
    public static double BytesToMegabytes(long bytes)
    Parameters
    Type Name Description
    System.Int64 bytes

    The bytes to be converted.

    Returns
    Type Description
    System.Double

    A megabyte representation equivalent to the specified bytes.

    | Improve this Doc

    BytesToTerabytes(Int64)

    Converts the specified bytes to its equivalent representation in terabytes.

    Declaration
    public static double BytesToTerabytes(long bytes)
    Parameters
    Type Name Description
    System.Int64 bytes

    The bytes to be converted.

    Returns
    Type Description
    System.Double

    A terabyte representation equivalent to the specified bytes.

    | Improve this Doc

    Factorial(Double)

    Calculates the factorial of a positive integer n denoted by n!.

    Declaration
    public static double Factorial(double n)
    Parameters
    Type Name Description
    System.Double n

    The positive integer to calculate a factorial number by.

    Returns
    Type Description
    System.Double

    The factorial number calculated from n, or System.Double.PositiveInfinity if n is to high a value.

    | Improve this Doc

    GetHighestValue(Decimal[])

    Gets the highest System.Decimal value of the specified System.Decimal values.

    Declaration
    public static decimal GetHighestValue(params decimal[] values)
    Parameters
    Type Name Description
    System.Decimal[] values

    A variable number of System.Decimal values to parse for the highest value.

    Returns
    Type Description
    System.Decimal

    The highest System.Decimal value of the specified System.Decimal values.

    | Improve this Doc

    GetHighestValue(Double[])

    Gets the highest System.Double value of the specified System.Double values.

    Declaration
    public static double GetHighestValue(params double[] values)
    Parameters
    Type Name Description
    System.Double[] values

    A variable number of System.Double values to parse for the highest value.

    Returns
    Type Description
    System.Double

    The highest System.Double value of the specified System.Double values.

    | Improve this Doc

    GetHighestValue(Int32[])

    Gets the highest System.Int32 value of the specified System.Int32 values.

    Declaration
    public static int GetHighestValue(params int[] values)
    Parameters
    Type Name Description
    System.Int32[] values

    A variable number of System.Int32 values to parse for the highest value.

    Returns
    Type Description
    System.Int32

    The highest System.Int32 value of the specified System.Int32 values.

    | Improve this Doc

    GetHighestValue(Int64[])

    Gets the highest System.Int64 value of the specified System.Int64 values.

    Declaration
    public static long GetHighestValue(params long[] values)
    Parameters
    Type Name Description
    System.Int64[] values

    A variable number of System.Int64 values to parse for the highest value.

    Returns
    Type Description
    System.Int64

    The highest System.Int64 value of the specified System.Int64 values.

    | Improve this Doc

    GetLowestValue(Decimal[])

    Gets the lowest System.Decimal value of the specified System.Decimal values.

    Declaration
    public static decimal GetLowestValue(params decimal[] values)
    Parameters
    Type Name Description
    System.Decimal[] values

    A variable number of System.Decimal values to parse for the lowest value.

    Returns
    Type Description
    System.Decimal

    The lowest System.Decimal value of the specified System.Decimal values.

    | Improve this Doc

    GetLowestValue(Double[])

    Gets the lowest System.Double value of the specified System.Double values.

    Declaration
    public static double GetLowestValue(params double[] values)
    Parameters
    Type Name Description
    System.Double[] values

    A variable number of System.Double values to parse for the lowest value.

    Returns
    Type Description
    System.Double

    The lowest System.Double value of the specified System.Double values.

    | Improve this Doc

    GetLowestValue(Int32[])

    Gets the lowest System.Int32 value of the specified System.Int32 values.

    Declaration
    public static int GetLowestValue(params int[] values)
    Parameters
    Type Name Description
    System.Int32[] values

    A variable number of System.Int32 values to parse for the lowest value.

    Returns
    Type Description
    System.Int32

    The lowest System.Int32 value of the specified System.Int32 values.

    | Improve this Doc

    GetLowestValue(Int64[])

    Gets the lowest System.Int64 value of the specified System.Int64 values.

    Declaration
    public static long GetLowestValue(params long[] values)
    Parameters
    Type Name Description
    System.Int64[] values

    A variable number of System.Int64 values to parse for the lowest value.

    Returns
    Type Description
    System.Int64

    The lowest System.Int64 value of the specified System.Int64 values.

    | Improve this Doc

    GetRandomNumber()

    Generates a nonnegative random number.

    Declaration
    public static int GetRandomNumber()
    Returns
    Type Description
    System.Int32

    A 32-bit signed integer greater than or equal to zero and less than System.Int32.MaxValue.

    | Improve this Doc

    GetRandomNumber(Int32)

    Generates a nonnegative random number less than the specified maximum.

    Declaration
    public static int GetRandomNumber(int maxValue)
    Parameters
    Type Name Description
    System.Int32 maxValue

    The exclusive upper bound of the random number to be generated. maxValue must be greater than or equal to zero.

    Returns
    Type Description
    System.Int32

    A 32-bit signed integer greater than or equal to zero, and less than maxValue; that is, the range of return values ordinarily includes zero but not maxValue. However, if maxValue equals zero, maxValue is returned.

    | Improve this Doc

    GetRandomNumber(Int32, Int32)

    Generates a random number within a specified range.

    Declaration
    public static int GetRandomNumber(int minValue, int maxValue)
    Parameters
    Type Name Description
    System.Int32 minValue

    The inclusive lower bound of the random number returned.

    System.Int32 maxValue

    The exclusive upper bound of the random number returned. maxValue must be greater than or equal to minValue.

    Returns
    Type Description
    System.Int32

    A 32-bit signed integer greater than or equal to minValue and less than maxValue; that is, the range of return values includes minValue but not maxValue. If minValue equals maxValue, minValue is returned.

    | Improve this Doc

    GetRandomNumber(Int32, Int32, RandomSeverity)

    Generates a random number within a specified range.

    Declaration
    public static int GetRandomNumber(int minValue, int maxValue, RandomSeverity severity)
    Parameters
    Type Name Description
    System.Int32 minValue

    The inclusive lower bound of the random number returned.

    System.Int32 maxValue

    The exclusive upper bound of the random number returned. maxValue must be greater than or equal to minValue.

    RandomSeverity severity

    The severity of the random number being generated.

    Returns
    Type Description
    System.Int32

    A 32-bit signed integer greater than or equal to minValue and less than maxValue; that is, the range of return values includes minValue but not maxValue. If minValue equals maxValue, minValue is returned.

    | Improve this Doc

    IsCountableSequence(IEnumerable<Int32>)

    Determines whether the specified source is a sequence of countable integrals (hence, integrals being either incremented or decremented with the same cardinality through out the sequence).

    Declaration
    public static bool IsCountableSequence(IEnumerable<int> source)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Int32> source

    The value to test for a sequence of countable characters.

    Returns
    Type Description
    System.Boolean

    true if the specified source is a sequence of countable integrals (hence, integrals being either incremented or decremented with the same cardinality through out the sequence); otherwise, false.

    | Improve this Doc

    IsCountableSequence(IEnumerable<Int64>)

    Determines whether the specified source is a sequence of countable integrals (hence, integrals being either incremented or decremented with the same cardinality through out the sequence).

    Declaration
    public static bool IsCountableSequence(IEnumerable<long> source)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Int64> source

    The value to test for a sequence of countable characters.

    Returns
    Type Description
    System.Boolean

    true if the specified source is a sequence of countable integrals (hence, integrals being either incremented or decremented with the same cardinality through out the sequence); otherwise, false.

    | Improve this Doc

    IsEven(Int32)

    Determines whether the specified value is an even number.

    Declaration
    public static bool IsEven(int value)
    Parameters
    Type Name Description
    System.Int32 value

    The value to evaluate.

    Returns
    Type Description
    System.Boolean

    true if the specified value is an even number; otherwise, false.

    | Improve this Doc

    IsOdd(Int32)

    Determines whether the specified value is an odd number.

    Declaration
    public static bool IsOdd(int value)
    Parameters
    Type Name Description
    System.Int32 value

    The value to evaluate.

    Returns
    Type Description
    System.Boolean

    true if the specified value is an odd number; otherwise, false.

    | Improve this Doc

    IsPrime(Int32)

    Determines whether the specified value is a prime number.

    Declaration
    public static bool IsPrime(int value)
    Parameters
    Type Name Description
    System.Int32 value

    The positive integer to determine whether is a prime number.

    Returns
    Type Description
    System.Boolean

    true if the specified value is a prime number; otherwise, false.

    Exceptions
    Type Condition
    System.ArgumentException

    value has a value smaller than 0.

    | Improve this Doc

    RoundOff(Double, RoundOffAccuracy)

    Rounds a double-precision floating-point value to the nearest integral value closest to the specified accuracy.

    Declaration
    public static double RoundOff(double value, RoundOffAccuracy accuracy)
    Parameters
    Type Name Description
    System.Double value

    A double-precision floating-point number to be rounded.

    RoundOffAccuracy accuracy

    The accuracy to use in the rounding.

    Returns
    Type Description
    System.Double

    The integer value closest to the specified accuracy of value.
    Note that this method returns a System.Double instead of an integral type.

    • Improve this Doc
    • View Source
    Back to top Copyright 2008-2018 Weubphoria. All rights reserved.
    Generated by DocFX