The closest equivalent is likely to be a BinaryWriterwrite to MemoryStreamor BitConverterfor a one-time conversion of a single value to an array of bytes.
If you want to control this, you can use my EndianBinaryWriter / EndianBitConverter from MiscUtil . Another feature of mine EndianBitConverteris that you can convert to a specific part of an existing array, which will help you if you want to port struct.packyourself.
source
share