hytos / ID2.Manager / MarkusImageCreate / Dapper / NotifyPropertyChange.cs @ dfb9a03c
이력 | 보기 | 이력해설 | 다운로드 (882 Bytes)
1 | 7842224c | taeseongkim | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.ComponentModel; |
||
4 | using System.Linq; |
||
5 | using System.Runtime.CompilerServices; |
||
6 | using System.Text; |
||
7 | using System.Threading.Tasks; |
||
8 | |||
9 | namespace ID2.Manager.Data |
||
10 | { |
||
11 | public class NotifyPropertyChange : INotifyPropertyChanged |
||
12 | { |
||
13 | |||
14 | public event PropertyChangedEventHandler PropertyChanged; |
||
15 | |||
16 | protected void RaisePropertyChanged(string propertyName) |
||
17 | { |
||
18 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
||
19 | } |
||
20 | |||
21 | protected virtual bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null) |
||
22 | { |
||
23 | if (EqualityComparer<T>.Default.Equals(storage, value)) |
||
24 | return false; |
||
25 | |||
26 | storage = value; |
||
27 | RaisePropertyChanged(propertyName); |
||
28 | return true; |
||
29 | } |
||
30 | } |
||
31 | } |