-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVM.cs
25 lines (21 loc) · 799 Bytes
/
VM.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace EvalUITest
{
// https://ru.stackoverflow.com/a/632894/10105
class VM : INotifyPropertyChanged
{
protected bool Set<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(field, value))
return false;
field = value;
NotifyPropertyChanged(propertyName);
return true;
}
protected void NotifyPropertyChanged([CallerMemberName] string propertyName = null) =>
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public event PropertyChangedEventHandler PropertyChanged;
}
}