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

后端 未结 6 1655
花落未央
花落未央 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:04

    I see, implementing ISerializable is not neccessary for this class.or you must add a constructor with signature (SerializationInfo information, StreamingContext context) : protected PersonName (SerializationInfo info, StreamingContext context){ this.NamePrefix = info.GetString("NamePrefix"); this.SurName = info.GetString("SurName"); this.GivenName = info.GetString("GivenName"); }

提交回复
热议问题