I am looking at an old piece of code and cannot somehow figure out the following:
public event EventHandler NameChanged;
#endregion
#region protected void OnNameChanged(EventArgs args)
protected void OnNameChanged(EventArgs args)
{
EventHandler eh = this.NameChanged;
if (eh != null)
{
eh(this, args);
}
}
Why is the event triggered by a delegate call? Can I not just name the event myself (NameChanged), as usual?
EDIT: I see that this is also offered on MSDN: https://docs.microsoft.com/en-us/dotnet/standard/events/
source
share