Change auto implemented properties to normal and deserialization with BinaryFormatter

后端 未结 2 905
不知归路
不知归路 2021-01-13 08:32

I have an object with a property implemented like

public String Bla {get;set;} 

After changing the implementation to something lik

2条回答
  •  借酒劲吻你
    2021-01-13 09:17

    The BinaryFormatter serializes the fields, not the properties.

    You could possibly get it to work by seeing what the auto-generated field name was in ILSpy or something similar and naming yours that way.

    Otherwise as stated by Henrik you would have to write your own deserialization, see this question for more information

    You can probably inspect the deserialization info by implementing ISerializable and special case this field.

提交回复
热议问题