What is the smartest way to load a string like \"10101011101010\" directly into a new bit array? (not a byte array)
(The bits shoul
How about something like this:
string bits = "101010101010"; byte[] bytes = bits.ToCharArray().Select(c => (byte)c == '0' ? 0 : 1).ToArray();
Might work...
or
byte[] bytes = bits.Select(c => (byte)c == '0' ? 0 : 1).ToArray();