Table of Contents

Class IsBitSetExtension

Namespace
Loehnert.Utility.Extensions
Assembly
Loehnert.Utility.dll

Extensions for getting the state of an bit.

public static class IsBitSetExtension
Inheritance
IsBitSetExtension
Inherited Members

Methods

IsBitSet(byte, int)

Gets a value indicating whether a bit is set.

public static bool IsBitSet(this byte value, int position)

Parameters

value byte

Value for getting the bit state.

position int

Bit position.

Returns

bool

True if the bit is set. Otherwise false.

Exceptions

ArgumentOutOfRangeException

Thrown when position is not between 0 and 7.

IsBitSet(ushort, int)

Gets a value indicating whether a bit is set.

public static bool IsBitSet(this ushort value, int position)

Parameters

value ushort

Value for getting the bit state.

position int

Bit position.

Returns

bool

True if the bit is set. Otherwise false.

Exceptions

ArgumentOutOfRangeException

Thrown when position is not between 0 and 15.

IsBitSet(uint, int)

Gets a value indicating whether a bit is set.

public static bool IsBitSet(this uint value, int position)

Parameters

value uint

Value for getting the bit state.

position int

Bit position.

Returns

bool

True if the bit is set. Otherwise false.

Exceptions

ArgumentOutOfRangeException

Thrown when position is not between 0 and 31.