Skip to content

IntegerExtensions Class ​

Definition ​

Extension methods to integer datatype

  • Namespace: JASE.Extensions
  • Assembly: JASE.Primitives.dll

Methods ​

NameDescription
void Fill(IList<int> list, int count)Populate the int list with the request count of sequential numbers
bool IsEven(int input)Evaluates the integer value to determine if it is Even
bool IsFlagSet(int value, int flag)Checks if a specific flag is set in the bitmask
bool IsOdd(int input)Evaluates the integer value to determine if it is Odd
bool IsPowerOf2(int input)Returns true if the input is a numeric power of 2
int RemoveFlag(int value, int flag)Remove a flag (turn the bit off)
int Round(int value, int nearest, bool clampOverflow = null)Returns input value rounded to the nearest specified multiple
int SetFlag(int value, int flag)Set a flag (turn the bit on)
string ToAlphaBasedIndex(int value, bool zeroBasedIndex = null)Converts integer to it's alpha based index (Ex: 0 = A 28 = AC, 258 = IY)
byte[] ToBits(int input, bool leftToRight = null)Converts an integer to its bit representation as a byte array.
byte[] ToBytes(int input, Endianness endianness = null)Converts an integer to a byte array considering endianness
int ToggleFlag(int value, int flag)Toggle a flag (switch the bitmask state)