Table of Contents

Class IntegerExtensions

Namespace
Cuemon.Extensions
Assembly
Cuemon.Extensions.Core.dll

Extension methods for the Int16, Int32 and Int64 structs.

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

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

IsEven(Int32)

Determines whether the specified value is an even number.

public static bool IsEven(this int value)

Parameters

value Int32

The value to evaluate.

Returns

Boolean

true if the specified value 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 Int32

The value to evaluate.

Returns

Boolean

true if the specified value 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 Int32

The positive integer to determine whether is a prime number.

Returns

Boolean

true if the specified value 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 Int16

The first of two 16-bit signed integers to compare.

minimum Int16

The second of two 16-bit signed integers to compare.

Returns

Int16

Parameter value or minimum, 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 Int32

The first of two 32-bit signed integers to compare.

minimum Int32

The second of two 32-bit signed integers to compare.

Returns

Int32

Parameter value or minimum, 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 Int64

The first of two 64-bit signed integers to compare.

minimum Int64

The second of two 64-bit signed integers to compare.

Returns

Int64

Parameter value or minimum, 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 Int16

The first of two 16-bit signed integers to compare.

maximum Int16

The second of two 16-bit signed integers to compare.

Returns

Int16

Parameter value or maximum, 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 Int32

The first of two 32-bit signed integers to compare.

maximum Int32

The second of two 32-bit signed integers to compare.

Returns

Int32

Parameter value or maximum, 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 Int64

The first of two 64-bit signed integers to compare.

maximum Int64

The second of two 64-bit signed integers to compare.

Returns

Int64

Parameter value or maximum, whichever is smaller.