Consider rewriting this:
if (this.ErrorOccurred != null)
{
this.ErrorOccurred(this, e);
}
Into:
var handler = ErrorOccurred;
if (handler != null)
{
handler(this, e);
}
Comments: ** Comment from web user: olegkap **
if (this.ErrorOccurred != null)
{
this.ErrorOccurred(this, e);
}
Into:
var handler = ErrorOccurred;
if (handler != null)
{
handler(this, e);
}
Comments: ** Comment from web user: olegkap **
Hi,
Thanks for this recommendation, didn't think of that.
But now I have a questions, should I lock var handler = ErrorOccurred; ?
Since potentially it could change during assignment operation.
Thanks,
Oleg