IDeserializationCallback vs OnDeserializedAttribute

前端 未结 4 2323
小蘑菇
小蘑菇 2021-02-19 10:45

As far as I understand, the IDeserializationCallback interface and the OnDeserialized event can both be used when an object needs to perform some task after being deserialized.<

4条回答
  •  一整个雨季
    2021-02-19 11:10

    I have wondered the same thing. As far as pros/cons go, I can only reason that the interface has an advantage in that it forces you to implement the correct method signature where-as the attribute version will happily let you compile your class regardless of what your method signature looks like.

提交回复
热议问题