using System; using ZeroLevel.Collections; namespace ZeroLevel.Extensions { internal static class BitArrayExtensions { // // serialize a bitarray. // //The bit array to convert // The bit array converted to an array of bytes. internal static byte[] ToBytes(this FastBitArray bits) { if (bits == null) return null; var numBytes = bits.Count / 8; if (bits.Count % 8 != 0) numBytes++; var bytes = new byte[numBytes]; bits.CopyTo(bytes, 0); return bytes; } } }