c# - Why does overriding GetHashCode() block INotifyPropertyChanged? -
i have dead simple view model inherits inotifypropertychanged
. after attempting create automated tests view model, ended overriding equals()
, gethashcode()
. tests passed, happy camper.
however, windows forms info bindings aren't reacting when property in view model changes. if comment gethashcode()
implementation works expected, except tests.
here implementation:
public override int gethashcode() { unchecked { var hashcode = (_subject != null ? _subject.gethashcode() : 0); hashcode = (hashcode * 397) ^ (_message != null ? _message.gethashcode() : 0); hashcode = (hashcode * 397) ^ (_body != null ? _body.gethashcode() : 0); homecoming hashcode; } }
this resharper generated me.
why overriding gethashcode()
stop info bindings picking on view model changes despite me calling propertychanged
event?
i seek avoid adding code production code solely testing purposes. since implemented equals
, gethashcode
testing purposes, possible implement iequalitycomparer<t>
, utilize in unit tests performs assertions.
c# winforms inotifypropertychanged
No comments:
Post a Comment