.NET behaviour of LayoutKind.explicit for a field which is itself a struct
问题 Question I tried building a struct ( SA ) using [StructLayout(LayoutKind.Explicit)] , which had a field which is another struct ( SB ). First : I was surprised I was allowed to declare that other struct without [StructLayout(LayoutKind.Explicit)] , whereas in SA , all fields must have [FieldOffset(0)] , or the compiler will shout. It doesn't make much sense. Is this a loophole in the compiler's warnings/errors ? Second : it seems that all reference ( object ) fields in SB are moved to the