Explisit Struct Layout

Hi I have the follow code.

    public struct BlockInt
        public uint Block; //Contains the Entire Block Data

        public byte Type; //the Block type. Ie Resource, Building Matrerial, Plant, Gas, Fluid
        public byte SubType; //The sub type. Ie if the type is Resource the sub type could be Iron, Coal, etc
        public ushort BlockId; //The block Id. A combanation of both the Type, and Subtype

        public byte Orientation; //the orientation of the block
        public byte Data; //the data that the block can contain

I have 2 questions.
First can I use [StructLayout(LayoutKind.Explicit)] on all platforms or do some platforms not have access to the InteropServices namespace?

And seconds whats the overhead in memory of having this vers just a single uint?


It should work on all platforms, as far as I know. There shouldn’t be any overhead in memory, except for the one time cost of the reflection information for the type, but that would be minor.

Thanks that defiantly good new for me.