Wednesday, April 1, 2015

Serialization Exception: PropertyChangedEventManager is not serializable

Since events are non serializable, here is the way out to deal the problem when serializing model classes which have a property changed event to notify the view model classes:

http://www.primordialcode.com/blog/post/serialization-exception-propertychangedeventmanager-serializable

[NonSerialized]
private PropertyChangedEventHandler _PropertyChanged;
 
public virtual event PropertyChangedEventHandler PropertyChanged
{
  add { _PropertyChanged += value; }
  remove { _PropertyChanged -= value; }
}

No comments:

Post a Comment