Can we have BitArray?

Any chance of BitArray in the next version?

Not in the list but if you explain why it is necessary then we can look into it.

Im sure its not necessary but its super convenient, very handy in manipulating registers.

This is good:
BitArray.Get()
BitArray.Set()
BitArray.SetAll()
BitArray.CopyTo()

eg. This configuration register has 2 bytes, if i want to just set bit 13 to 0 (BRNG to 0 = 16V FSR
id first read the register, copy to a bitarray and just set bit 13 from 1 (default) to 0

Currently im working out how to use enum flags, masks or using bool array, and converting back and forth to a byte
What’s really frustrating is half of the stuff is missing which si available in full .NET, i spend lots of time searching for workaround to common problems.

eg.
Array.Reverse(result); - not available
String.StartsWith - not available

We are here to help

x = x | (1<<7) // set the seventh bit
x = x & ~(1<<4) // clear the fourth bit

3 Likes

Thanks, this helps

You may also have a look at our “Bits class” in MBNCore.cs. It contains many bits manipulations.

2 Likes