c# - 编码(marshal) c# 结构成员

标签 c# struct marshalling

我不确定如何解释 MSDN 中的 LayoutKind.Explicit:

The precise position of each member of an object in unmanaged memory is explicitly controlled. Each member must use the FieldOffsetAttribute to indicate the position of that field within the type.

成员是否与 CSharp 语言规范 §11.2 中定义的相同(因此方法可以存在并且 是编码的),还是像 §10.5 中那样表示字段,还是像 §5 中那样表示变量

最佳答案

很明显,每个“成员”都必须标记FieldOffsetAttribute,它只支持字段成员。

关于c# - 编码(marshal) c# 结构成员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27572085/

相关文章:

c# - 使用 Linq 进行 ObjectDataSource : How to transform datetime using ToShortTimeString?

c# - Azure 辅助角色响应时间缓慢

java - 为什么 JAXB 需要一个无参数构造函数来编码?

C# 将 SecureString 安全地转换为 UTF-8 byte[]

c# - 为什么这个日期时间方法会失败?

c# - 在结构中分配字段/属性

swift - swift 中的协议(protocol)继承和结构

c - 不理解 'C' : (regs_t*) cntl->addr 中结构的引用

c - 将 memmove 与指针一起使用

java - 如何停止 Marshaller 类在我的输出文件中添加 XML 标记