Advertisement
Guest User

Untitled

a guest
Sep 30th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. protected bool SetProperty<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
  2. {
  3. if (EqualityComparer<T>.Default.Equals(field, value))
  4. {
  5. return false;
  6. }
  7.  
  8. field = value;
  9. OnPropertyChanged(propertyName);
  10. return true;
  11. }
  12.  
  13.  
  14. protected bool SetProperty<T>(ref T field, T value, Expression<Func<T>> selectorExpression)
  15. {
  16. if (EqualityComparer<T>.Default.Equals(field, value))
  17. {
  18. return false;
  19. }
  20.  
  21. field = value;
  22. OnPropertyChanged(selectorExpression);
  23. return true;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement