SerializationException when serializing instance of a class which implements INotifyPropertyChanged

前端 未结 1 500
故里飘歌
故里飘歌 2020-12-15 18:42

i am trying to serialize a field of my class. Withou it serialization is fine, with it a get SerializationException.

Field is : private readonly ObservableColl

1条回答
  •  天命终不由人
    2020-12-15 19:40

    Try out marking event PropertyChanged by [NonSerialized] attribute

    below is syntax for events: (see MSDN)

    [field:NonSerializedAttribute()] 
    public event ChangedEventHandler Changed;
    

    0 讨论(0)
提交回复
热议问题