1.Prefer the binary formatter.

2.Mark serialization event-handling methods as private.

3.Use the generic IGenericFormatter interface.

4.Always mark non-sealed classes as serializable.

5.When implementing IDeserializationCallback on a non-sealed class, make sure to do so in a way that allows subclasses to call the base class implementation of OnDeserialization( ).

6.Always mark unserializable member variables as non-serializable.

7.Always mark delegates on a serialized class as non-serializable fields:

[Serializable]
public class MyClass
{
   [field:NonSerialized]
   public event EventHandler MyEvent;
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
  • 2021-10-15
猜你喜欢
  • 2021-12-10
  • 2021-07-17
  • 2021-11-30
  • 2021-06-02
  • 2021-08-14
  • 2021-07-20
  • 2022-12-23
相关资源
相似解决方案