For my current project, I've implemented a Shared AssemblyInfo.cs file, mostly because every project is from the same company and share some common version numbers. In one of my console applications, I needed to construct a header using the Assembly Title and Copyright information from my SharedAssemblyInfo.cs file. To achieve this, I added the following to the end of SharedAssemblyInfo.cs: namespace MyNamespace { public static class AssemblyInfo { public static string Title { get { var attr = GetAssemblyAttribute<Ass...
Here's an extension method that packs a C# BitArray to a byte array: public static byte[] ToByteArray(this BitArray bits) { int numBytes = bits.Count / 8; if (bits.Count % 8 != 0) numBytes++; byte[] bytes = new byte[numBytes]; int byteIndex = 0, bitIndex = 0; for (int i = 0; i < bits.Count; i++) { if (bits[i]) bytes[byteIndex] |= (byte)(1 << (7 - bitIndex)); bitIndex++; if (bitIndex == 8) { bitIndex = 0; byteIndex++; } } return bytes; } Special thanks to the good people at StackOverflow!...