Table of Contents

Class IntegerExtensions

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

Extension methods for the short, int and long structs.

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 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<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 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(int)

Determines whether the specified value is an even number.

public static bool IsEven(this int value)

Parameters

value int

The value to evaluate.

Returns

bool

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

The value to evaluate.

Returns

bool

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

The positive integer to determine whether is a prime number.

Returns

bool

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

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

minimum short

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

Returns

short

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

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

minimum int

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

Returns

int

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

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

minimum long

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

Returns

long

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

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

maximum short

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

Returns

short

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

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

maximum int

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

Returns

int

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

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

maximum long

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

Returns

long

Parameter value or maximum, whichever is smaller.