Marshalling a big-endian byte collection into a struct in order to pull out values

Here’s another solution for swapping endianness. It’s adjusted from Adam Robinsons solution here: https://stackoverflow.com/a/2624377/1254743 It’s even capable of handling nested structs. public static class FooTest { [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Foo2 { public byte b1; public short s; public ushort S; public int i; public uint I; public long l; public ulong L; … Read more