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
source
IEnumerable<int>The value to test for a sequence of countable characters.
Returns
- bool
true
if the specifiedsource
is 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
source
IEnumerable<long>The value to test for a sequence of countable characters.
Returns
- bool
true
if the specifiedsource
is 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
value
intThe value to evaluate.
Returns
- bool
true
if the specifiedvalue
is an even number; otherwise,false
.
IsOdd(int)
Determines whether the specified value
is an odd number.
public static bool IsOdd(this int value)
Parameters
value
intThe value to evaluate.
Returns
- bool
true
if the specifiedvalue
is an odd number; otherwise,false
.
IsPrime(int)
Determines whether the specified value
is a prime number.
public static bool IsPrime(this int value)
Parameters
value
intThe positive integer to determine whether is a prime number.
Returns
- bool
true
if the specifiedvalue
is a prime number; otherwise,false
.
Exceptions
- ArgumentException
value
has 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
value
shortThe first of two 16-bit signed integers to compare.
minimum
shortThe second of two 16-bit signed integers to compare.
Returns
- short
Parameter
value
orminimum
, 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
value
intThe first of two 32-bit signed integers to compare.
minimum
intThe second of two 32-bit signed integers to compare.
Returns
- int
Parameter
value
orminimum
, 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
value
longThe first of two 64-bit signed integers to compare.
minimum
longThe second of two 64-bit signed integers to compare.
Returns
- long
Parameter
value
orminimum
, 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
value
shortThe first of two 16-bit signed integers to compare.
maximum
shortThe second of two 16-bit signed integers to compare.
Returns
- short
Parameter
value
ormaximum
, 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
value
intThe first of two 32-bit signed integers to compare.
maximum
intThe second of two 32-bit signed integers to compare.
Returns
- int
Parameter
value
ormaximum
, 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
value
longThe first of two 64-bit signed integers to compare.
maximum
longThe second of two 64-bit signed integers to compare.
Returns
- long
Parameter
value
ormaximum
, whichever is smaller.