Class IntegerExtensions
- Namespace
- Cuemon.Extensions
- Assembly
- Cuemon.Extensions.Core.dll
public static class IntegerExtensions
- Inheritance
-
IntegerExtensions
Methods
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).
public static bool IsCountableSequence(this IEnumerable<int> source)
Parameters
source
IEnumerable<Int32>The value to test for a sequence of countable characters.
Returns
- Boolean
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<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).
public static bool IsCountableSequence(this IEnumerable<long> source)
Parameters
source
IEnumerable<Int64>The value to test for a sequence of countable characters.
Returns
- Boolean
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(Int32)
Determines whether the specified value
is an even number.
public static bool IsEven(this int value)
Parameters
value
Int32The value to evaluate.
Returns
- Boolean
true
if the specifiedvalue
is an even number; otherwise,false
.
IsOdd(Int32)
Determines whether the specified value
is an odd number.
public static bool IsOdd(this int value)
Parameters
value
Int32The value to evaluate.
Returns
- Boolean
true
if the specifiedvalue
is an odd number; otherwise,false
.
IsPrime(Int32)
Determines whether the specified value
is a prime number.
public static bool IsPrime(this int value)
Parameters
value
Int32The positive integer to determine whether is a prime number.
Returns
- Boolean
true
if the specifiedvalue
is a prime number; otherwise,false
.
Exceptions
- ArgumentException
value
has a value smaller than 0.
Max(Int16, Int16)
Returns the larger of two 16-bit signed integers.
public static short Max(this short value, short minimum)
Parameters
value
Int16The first of two 16-bit signed integers to compare.
minimum
Int16The second of two 16-bit signed integers to compare.
Returns
- Int16
Parameter
value
orminimum
, whichever is larger.
Max(Int32, Int32)
Returns the larger of two 32-bit signed integers.
public static int Max(this int value, int minimum)
Parameters
value
Int32The first of two 32-bit signed integers to compare.
minimum
Int32The second of two 32-bit signed integers to compare.
Returns
- Int32
Parameter
value
orminimum
, whichever is larger.
Max(Int64, Int64)
Returns the larger of two 64-bit signed integers.
public static long Max(this long value, long minimum)
Parameters
value
Int64The first of two 64-bit signed integers to compare.
minimum
Int64The second of two 64-bit signed integers to compare.
Returns
- Int64
Parameter
value
orminimum
, whichever is larger.
Min(Int16, Int16)
Returns the smaller of two 16-bit signed integers.
public static short Min(this short value, short maximum)
Parameters
value
Int16The first of two 16-bit signed integers to compare.
maximum
Int16The second of two 16-bit signed integers to compare.
Returns
- Int16
Parameter
value
ormaximum
, whichever is smaller.
Min(Int32, Int32)
Returns the smaller of two 32-bit signed integers.
public static int Min(this int value, int maximum)
Parameters
value
Int32The first of two 32-bit signed integers to compare.
maximum
Int32The second of two 32-bit signed integers to compare.
Returns
- Int32
Parameter
value
ormaximum
, whichever is smaller.
Min(Int64, Int64)
Returns the smaller of two 64-bit signed integers.
public static long Min(this long value, long maximum)
Parameters
value
Int64The first of two 64-bit signed integers to compare.
maximum
Int64The second of two 64-bit signed integers to compare.
Returns
- Int64
Parameter
value
ormaximum
, whichever is smaller.