mo.notono.us

Tuesday, September 13, 2005

Safely firing an event

This topic came up again at work today:
jaybaz [MS] WebLog : Safely firing an event:

The safe way is to use the copy-and-test pattern:

void FireSomeEvent()
{
  D temp = SomeEvent;
  if (temp != null)
  {
    temp();
  }
}

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home