private void RaiseOperationComplete(EventArgs
{
if(OperationComplete != null)
{
OperationComplete(this, e);
}
}
In the above case, suppose two thread subscribed to the same OperationComplete handler and one unsubscribed the event. In such scenario the OperationComplete event will become null and for the next thread due to the event is null it will not execute. This happens mainly in multithreaded applications but you can't guarantee for single threaded application too.
So what to do? How can we make sure that our application will not come into such situation and work properly?