Skip to content

Int32Extensions.SetBits Method ​

Definition ​

Sets a range of bits in an int to the specified value.

c#
public static int SetBits(this int value, int bits, int startInclusive, int endInclusive);

View source

Parameters ​

NameTypeDescription
valueInt32
bitsInt32The value to set in the bit range.
startInclusiveInt32The zero-based start bit index, inclusive.
endInclusiveInt32The zero-based end bit index, inclusive.

Returns ​

Int32

A new int with the specified bit range replaced by bits.