Struct Layout #113318
Answered
by
EgorBo
Silencersn
asked this question in
Q&A
Struct Layout
#113318
-
I have two structs like: [StructLayout(LayoutKind.Auto)]
public struct A
{
public byte Field1;
public int Field2;
public short Field3;
}
[StructLayout(LayoutKind.Auto)]
public struct B
{
public byte Field1;
public int Field2;
public short Field3;
} They have the same data fields and StructLayout. |
Beta Was this translation helpful? Give feedback.
Answered by
EgorBo
Mar 10, 2025
Replies: 1 comment 5 replies
-
@Silencersn Yes, but it's an implementation detail - you should not rely on offsets/sizes or do reinterp-like casts for structs with Auto layout |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
Silencersn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Silencersn Yes, but it's an implementation detail - you should not rely on offsets/sizes or do reinterp-like casts for structs with Auto layout