All C# extension methods for type int32

IsPrime
Returns true when a integer is a prime.

TryParse
This method takes away the need for writing two lines for TryParse and gives users an option of returning a default number.

int.IsNumber()
Checks if an integer is a number

IsOdd
Checks whether a number is odd

KB,MB,GB,TB
Simplest way to get a number of bytes at different measures. KB, MB, GB or TB,

IsInRange
Finds if the int is the specified range

IsEven
Checks whether a number is even

ToInteger
Convert datatable field to int32

Map
Remaps a number from one range to another. That is, a value of fromLow would get mapped to toLow, a value of fromHigh to toHigh, values inbetween to values inbetween, etc. (like Arduino function map) Parameters value: the number to map. fromLow: the lower bound of the value’s current range. fromHigh: the upper bound of the value’s current range. toLow: the lower bound of the value’s target range. toHigh: the upper bound of the value’s target range.

WordCount
Count all words in a given string. Excludes whitespaces, tabs and line breaks.

LCM
Uses the Euclidean Algorithm to determine the Least Common Multiplier for an array of integers

ToArray
Returns an array of int containing all caracters that compose the number.

Squared
Returns the squared value

To
Creates a range of integers as an IEnumerable<Int32>.

SecondsToString
Converts the number of seconds to a string displaying hours and minutes

IntToGuid
Converts an integer to a Guid. This could be used within a unit test to mock objects.

Length
Determines how many numbers compose the integer if it was represented as a string.

Times
Repeats an action a number of times.

KB
Simplest way to get a number of kilobytes.

MultiplyBy
A simple multiplication extension. Backing idea is to overcome the ridiculous flaw in the Int32 value type when a regular multiplication overflows the Int32 value range. Along these lines it would also be possible to gracefully return larger values as e.g. longs, or as BigInt (when the BCL team gets around to implementing it ;). But the example here sticks to the bounds of the Int32 range.

ExcelColumnName
Returns the excel column name from a column index

TimesSelector
Inspired from ye good old ruby on rails, provides you with new DateTime instances based on an integer you provide. Look at realfiction.net > extension methods for more detail

MB
Simplest way to get a number of megabytes.

In
Returns true when a number is included in the specified collection.

TimesOrUntil
Attempts to retrieve a valid a result from your function one or more times with an optional 'in between' step (i.e. delay). Replaces a common code pattern with a more readable, shared pattern.

Intuitive date creation
Allows you to create date very easily, like 19.June(1970)

IntegerToTimeSpan
Converts an integer to a timespan

AddOrdinal
Add an ordinal to a number,

AsSequenceTo
Creates a numeric list of integers starting at the current instance and ending at the maximum value.

Fluent DateOnly Extensions
A fluent way to create DateOnly values.

Maximum number in Array of Random Numbers
Make an array of generated random numbers and get the maximum number every time you run.