【发布时间】:2021-08-11 07:43:15
【问题描述】:
我想编组一个用于 P/Invoke 的结构,但该结构包含一个仅与我的托管代码相关的字段,因此我不希望它被编组,因为它不属于本机结构体。甚至可能吗?一直在找类似NonSerialized的属性进行序列化,但是好像不存在……
struct MyStructure
{
int foo;
int bar;
[NotMarshaled] // This attribute doesn't exist, but that's the kind of thing I'm looking for...
int ignored;
}
任何建议将不胜感激
【问题讨论】:
标签: .net structure pinvoke marshalling