Bomret/NeverNull

Serialization Option fails

2moveit opened this issue · 1 comments

Hi, serialization with Newtonsoft.Json does not work.
If you serialize 2.0.ToOption() then it does not save the value:
{"OptionProperty":{"HasValue":true,"IsEmpty":false}}
Maybe it's possible to write a JsonConverter for that but the better way would be supporting serialization with the Option type by default. Or am I doing something wrong?

Hi @2moveit. No, you're not doing it wrong. I also would like to add generic serialization via the Serializable attribute and ISerializable interface but this is not available in the current compilation target (PCL Profile 328). I'd like to convert the whole project to .net core which supports those but would lose compatibility with .net 4.0. But I think it would be worth it.