BACnet.Types.BitString8.WithBit C# (CSharp) Method

WithBit() public method

Creates a copy of this bitstring with a certain bit overriden
public WithBit ( int index, bool set = true ) : BitString8
index int The bit to override
set bool The value to override to
return BitString8
        public BitString8 WithBit(int index, bool set = true)
        {
            var mask = (byte)(0x80 >> index);
            byte flags = _flags;
            if (set)
                flags |= mask;
            else
                flags &= (byte)~mask;
            return new BitString8(_length, flags);
        }