Convert BitArray to a small byte array
问题 I've read the other posts on BitArray conversions and tried several myself but none seem to deliver the results I want. My situation is as such, I have some c# code that controls an LED strip. To issue a single command to the strip I need at most 28 bits 1 bit for selecting between 2 led strips 6 for position (Max 48 addressable leds) 7 for color x3 (0-127 value for color) Suppose I create a BitArray for that structure and as an example we populate it semi-randomly. BitArray ba = new BitArray