简体   繁体   中英

Making a third-party struct serialisable

So basically I'm using a third party library which has a particular Struct which I need to serialise.

The actual struct is heavily used by other functions which I need, so I can't just rewrite it myself from scratch.

I can't extend the struct itself (because structs can't be extended) and the solution I found here won't really work for me as I'm using it in a ton of classes which I can't stay implementing serialisation manually for.

Anything I can do ?

您可以使用SerializationSurrogate来序列化非为序列化设计的类型的实例。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM