C#C
C#4y ago
Yonatan

How do I call a null event?

public delegate void MyDel();

        public event MyDel MyEvent;

        public void LeftClickPressed()
        {
            if (MyEvent != null)
                MyEvent();
        }

In here, the event is always null.
I Subscribed to it from a different class so everytime I trigger this event, a function will also run from that second class.

However this event never triggers because it is always null.
What Am I missing here?
Was this page helpful?