For some reason my event is throwing a null error. I don’t see anything wrong.
here is the event
public delegate void connectionSuccess(bool success);
public event connectionSuccess Connection;
then in a function i have this witch throws the null error
Connection(true);
Edit* function in another class that calls the connection function
Server.Connection += onConnection;
Server.startConnection();
If it is not connected, it is
null.Try this instead:
I’m assigning to a (local) variable first in order to overcome multi-threading scenarios where there are modifications between checking for
nulland calling.I.e. the following would not be thread-safe: