更新时间:2021-08-21 05:56:01
有没有办法做到这一点的管理结构。 Marshal.SizeOf
只会返回上包括结构的的封...类型的数据的大小可能的是托管类型正确在某些平台上,而不是别人。
There is no way to do it for managed structs. Marshal.SizeOf
will only return the size of the data on the marshaled types that comprise the struct... that MIGHT be correct for the managed types on some platforms, but not on others.
这是由设计使JIT可以根据其上运行的平台上不同打好结构。
This is by design so the JIT can lay structs differently depending on the platform it runs on.
在此处了解详情:克里斯Brumme的博客