Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Student
- {
- private string name;
- private int age;
- // This is just a template.
- public delegate void PropertyChangedHandler(PropertyChangedEventArgs args);
- // Our public event( array of methods, functions...), based on our template!
- public event PropertyChangedHandler OnPropertyChanged;
- public Student () { }
- public string Name
- {
- get { return this.name; }
- set
- {
- // Our template accepts instance of class "PropertyChangedEventArgs"
- // Create instance and pass it to the event
- var eventArgs = new PropertyChangedEventArgs ("name", this.name, value);
- this.name = value;
- OnPropertyChanged (eventArgs);
- }
- }
- public int Age
- {
- get { return this.age; }
- set
- {
- // Our template accepts instance of class "PropertyChangedEventArgs"
- // Create instance and pass it to the event
- var eventArgs = new PropertyChangedEventArgs ("age", this.age, value);
- this.age = value;
- OnPropertyChanged (eventArgs);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement