private static byte CreateByte(List <bool> controlBits, int index) { byte b = 0; for (int i = 0; i < 7; i++) { if (index * 7 + i < controlBits.Count) { BitWise.SSetBit(ref b, i, controlBits[index * 7 + i] ? 1 : 0); } } return(b); }