Managing bit packed data using C#
I'm working on a TCP based application that processes bitpacked messages, meaning:  The messages transmitted/received are not byte aligned.  For instance 3 bits represent field 1, where 19 bits may represent field 2.  My question is, does anyone know of a C# library that can take a set of bytes and set/get an arbitrary range of bits within those bytes?  I've seen & created similar utilities in C/C++ but I need a 100% C# solution and I don't want to re-invent the wheel again.

I've looked at the BitArray class, but it doesn't allow for referencing arbitrary ranges of bits.
Managing bit packed data using C#
===

I'm working on a TCP based application that processes bitpacked messages, meaning:  The messages transmitted/received are not byte aligned.  For instance 3 bits represent field 1, where 19 bits may represent field 2.  My question is, does anyone know of a C# library that can take a set of bytes and set/get an arbitrary range of bits within those bytes?  I've seen & created similar utilities in C/C++ but I need a 100% C# solution and I don't want to re-invent the wheel again.

I've looked at the BitArray class, but it doesn't allow for referencing arbitrary ranges of bits.