Is implementing ISerializable interface necessary when not implementing any custom serialization/deserialization

后端 未结 6 1653
花落未央
花落未央 2021-01-11 10:45

I am looking at a class in a solution that implements the ISerializable interface. It has a GetObjectData method for serialization as required by t

6条回答
  •  耶瑟儿~
    2021-01-11 11:11

    the class really doesn't need to implement the ISerializable interface in the first place. Is that correct?

    Correct. Implementing ISerializable is when you need to do something other than the default serialization behavior. The [Serializable] attribute should be enough.

提交回复
热议问题