From a Tip/Trick here on CP
The Weird and The Wonderful
1
Posts
1
Posters
0
Views
1
Watching
-
protected virtual bool SetProperty
(ref T storage, T value, [CallerMemberName] string propertyName = null)
{
if (Equals(storage, value)) return false;storage = value; this.RaisePropertyChanged(propertyName); return true; } protected virtual bool SetPropertySafely (ref T storage, T value, \[CallerMemberName\] string propertyName = null) { if (Equals(storage, value)) return false; storage = value; this.RaisePropertyChangedSafely(propertyName); return true; } protected virtual bool SetPropertySafelyFast (ref T storage, T value, \[CallerMemberName\] string propertyName = null) { if (Equals(storage, value)) return false; storage = value; this.RaisePropertyChangedSafelyFast(propertyName); return true; }
The topic is about making data changes visible ASAP on the UI (WPF) from another thread. Either all methods above are safe & fast, or all of them are slow and unsave. I tend towards the latter. :laugh: