Is it possible to do .NET binary serialization of an object when you don't have the source code of the class?

后端 未结 6 1116
星月不相逢
星月不相逢 2020-11-27 04:52

I am using BinaryFormatter to do binary serialization of some objects in C#. However, some of the objects contain classes that I access via a DLL and do not hav

6条回答
  •  日久生厌
    2020-11-27 05:11

    Create a new class, inherit the existing class that is not marked with serialization attribute and implement ISerializable interface.

    If the class is sealed then you can use Json.NET and then convert it to binary and vice versa (Sucks big time, use it if nothing else can help :)).

提交回复
热议问题