File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Advanced-C#-Programming/16_Predefined-Interfaces Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -100,3 +100,36 @@ public object Clone()
100
100
}
101
101
*/
102
102
#endregion
103
+
104
+
105
+ #region INotifyPropertyChanged Interface
106
+ //INotifyPropertyChanged interface is used to notify the subscribers when a property is changed. Is generally used in data binding scenarios.
107
+ /*
108
+ Person p = new Person { Name = "Hakan", Age = 22 };
109
+
110
+ p.PropertyChanged += (sender, e) =>
111
+ {
112
+ Console.WriteLine($"{e.PropertyName} has been changed.");
113
+ };
114
+
115
+ p.Age = 25; // Age has been changed.
116
+ public class Person : INotifyPropertyChanged
117
+ {
118
+ public string Name { get; set; }
119
+ int age;
120
+
121
+ public int Age
122
+ {
123
+ get => age;
124
+ set
125
+ {
126
+ age = value;
127
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Age)));
128
+
129
+ }
130
+ }
131
+ public event PropertyChangedEventHandler? PropertyChanged;
132
+ }
133
+ */
134
+ #endregion
135
+
You can’t perform that action at this time.
0 commit comments