Class IntegerExtensions
- Namespace
- Cuemon.Extensions
- Assembly
- Cuemon.Extensions.Core.dll
public static class IntegerExtensions
- Inheritance
-
IntegerExtensions
Methods
IsCountableSequence(IEnumerable<int>)
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).
public static bool IsCountableSequence(this IEnumerable<int> source)
Parameters
sourceIEnumerable<int>The value to test for a sequence of countable characters.
Returns
- bool
trueif the specifiedsourceis a sequence of countable integrals (hence, integrals being either incremented or decremented with the same cardinality through out the sequence); otherwise,false.
IsCountableSequence(IEnumerable<long>)
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).
public static bool IsCountableSequence(this IEnumerable<long> source)
Parameters
sourceIEnumerable<long>The value to test for a sequence of countable characters.
Returns
- bool
trueif the specifiedsourceis a sequence of countable integrals (hence, integrals being either incremented or decremented with the same cardinality through out the sequence); otherwise,false.
IsEven(int)
Determines whether the specified value is an even number.
public static bool IsEven(this int value)
Parameters
valueintThe value to evaluate.
Returns
- bool
trueif the specifiedvalueis an even number; otherwise,false.
IsOdd(int)
Determines whether the specified value is an odd number.
public static bool IsOdd(this int value)
Parameters
valueintThe value to evaluate.
Returns
- bool
trueif the specifiedvalueis an odd number; otherwise,false.
IsPrime(int)
Determines whether the specified value is a prime number.
public static bool IsPrime(this int value)
Parameters
valueintThe positive integer to determine whether is a prime number.
Returns
- bool
trueif the specifiedvalueis a prime number; otherwise,false.
Exceptions
- ArgumentException
valuehas a value smaller than 0.
Max(short, short)
Returns the larger of two 16-bit signed integers.
public static short Max(this short value, short minimum)
Parameters
valueshortThe first of two 16-bit signed integers to compare.
minimumshortThe second of two 16-bit signed integers to compare.
Returns
- short
Parameter
valueorminimum, whichever is larger.
Max(int, int)
Returns the larger of two 32-bit signed integers.
public static int Max(this int value, int minimum)
Parameters
valueintThe first of two 32-bit signed integers to compare.
minimumintThe second of two 32-bit signed integers to compare.
Returns
- int
Parameter
valueorminimum, whichever is larger.
Max(long, long)
Returns the larger of two 64-bit signed integers.
public static long Max(this long value, long minimum)
Parameters
valuelongThe first of two 64-bit signed integers to compare.
minimumlongThe second of two 64-bit signed integers to compare.
Returns
- long
Parameter
valueorminimum, whichever is larger.
Min(short, short)
Returns the smaller of two 16-bit signed integers.
public static short Min(this short value, short maximum)
Parameters
valueshortThe first of two 16-bit signed integers to compare.
maximumshortThe second of two 16-bit signed integers to compare.
Returns
- short
Parameter
valueormaximum, whichever is smaller.
Min(int, int)
Returns the smaller of two 32-bit signed integers.
public static int Min(this int value, int maximum)
Parameters
valueintThe first of two 32-bit signed integers to compare.
maximumintThe second of two 32-bit signed integers to compare.
Returns
- int
Parameter
valueormaximum, whichever is smaller.
Min(long, long)
Returns the smaller of two 64-bit signed integers.
public static long Min(this long value, long maximum)
Parameters
valuelongThe first of two 64-bit signed integers to compare.
maximumlongThe second of two 64-bit signed integers to compare.
Returns
- long
Parameter
valueormaximum, whichever is smaller.