Skip to content

Int32Extensions Class ​

Definition ​

Extension methods for Int32.

c#
public static class Int32Extensions

View source

Methods ​

NameDescription
GetBit(Int32, Int32)Gets the value of the bit at the specified index.
GetBits(Int32, Int32, Int32)Gets a range of bits from an int, shifted down to the least significant position.
LeftMostBit(Int32)Gets the left-most bit (bit 31) of an int.
ResetBit(Int32, Int32)Returns a new int with the bit at the specified index cleared.
RightMostBit(Int32)Gets the right-most bit (bit 0) of an int.
SetBit(Int32, Int32)Returns a new int with the bit at the specified index set.
SetBits(Int32, Int32, Int32, Int32)Sets a range of bits in an int to the specified value.
SignBit(Int32)Gets the sign bit (bit 31) of an int.
ToBinaryString(Int32)Converts an int to its binary string representation, for example, "0b00000000000000000000000001011010".