Table of Contents

Class SetBitExtension

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

Extensions for setting an bit.

public static class SetBitExtension
Inheritance
SetBitExtension
Inherited Members

Methods

SetBit(byte, int)

Sets the bit at the position.

public static byte SetBit(this byte value, int position)

Parameters

value byte

Value to set a bit.

position int

Bit position.

Returns

byte

The value with the bit set.

Exceptions

ArgumentOutOfRangeException

Thrown when position is not between 0 and 7.

SetBit(ushort, int)

Sets the bit at the position.

public static ushort SetBit(this ushort value, int position)

Parameters

value ushort

Value to set a bit.

position int

Bit position.

Returns

ushort

The value with the bit set.

Exceptions

ArgumentOutOfRangeException

Thrown when position is not between 0 and 15.

SetBit(uint, int)

Sets the bit at the position.

public static uint SetBit(this uint value, int position)

Parameters

value uint

Value to set a bit.

position int

Bit position.

Returns

uint

The value with the bit set.

Exceptions

ArgumentOutOfRangeException

Thrown when position is not between 0 and 31.