Skip to content

ByteExtensions.SetBits Method ​

Definition ​

Sets a range of bits in a byte to the specified value.

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

View source

Parameters ​

NameTypeDescription
originalByteThe original byte value.
valueByteThe value to set in the bit range.
startInclusiveInt32The zero-based start bit index, inclusive.
endInclusiveInt32The zero-based end bit index, inclusive.

Returns ​

Byte

A new byte with the specified bit range replaced by value.