I have a List which I want to convert to a byte[]. How do i do this? list.toArray() creates a bool[].
List
byte[]
list.toArray()
bool[]
Another LINQ approach, less effective than @hfcs101's but would easily work for other value types as well:
var a = new [] { true, false, true, true, false, true }; byte[] b = a.Select(BitConverter.GetBytes).SelectMany(x => x).ToArray();