PropertyChangedEventHandler and Delegates & Events in general
Hi
I would just like clarification on Delegates and Events in particular the PropertyChangedEventHandler delegate. I think ive got a good grasp but I just wanted to be put right in certain places if necessary please.
// Declare PropertyChangedEventArgs which derives from the EventArgs base. This is used as it contains additional functionality instead of using the standard EventArgs.
public class PropertyChangedEventArgs : Eventargs
public PropertyChangedEventArgs(string propertyName);
public virtual string PropertyName { get; }
// Declare Delegate which takes PropertyChangedEventArgs as the 2nd parameter due to the added functionality it provides (as in the step above).
public delegate void PropertyChangedEventHandler(object sender, PropertyChangedEventArgs e)
// Declare the EventHandler with an identifer\variable named PropertyChanged.
public event PropertyChangedEventHandler PropertyChanged
// Declare a method that fires the Event which matches the signiture of the delegate and holds a reference to the EventHandler.
public void RaisePropertyChanged(string propertyName)
PropertychangedEventHandler propertyChanged = PropertyChanged;
if(propertyChanged != null)
// Not sure
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
My question is how could this Event be assigned to a method I know it is subscribed by using the operator += and removed as a subscriber by -=
Thanks!