Marshal.PtrToStructure (and back again) and generic solution for endianness swapping
Reflection does seem like the only real way to accomplish what you’re after. I’ve put together some code below. It creates an attribute called EndianAttribute that can be applied at the field level on a struct. I’ve included the definition for this attribute and it’s associated enum, as well as the modifications to your code … Read more