Do I really have to check for NULL before invoking an event? ... short answer... YES!

Yes, because you never know when "someone" might clear all listeners.
Don't worry though... C# has a great short-cut method for this... the Null-Conditional operator ?.

public class LocationEventArgs : EventArgs
{
    public int Index;
    public Point Location;
}

public event EventHandler<LocationEventArgs> ActorLocationUpdated;

private void textBoxLocation_Leave(object sender, EventArgs e)
{
        ActorLocationUpdated?.Invoke(this, new LocationEventArgs() { Location = ActorLocation, Index = ActorIndex });

Comments