E
emma_middlebrook
Hi
In MSDN, in the Using Events (C# Programming Guide), declaring event
accessors part it uses the following ...
But the lock will fail at the first call to add because
TestEventHandlers is null.
Any ideas how to fix this up? I can't just initialize the event with
something because it doesn't really make sense ...
private TestEventDelegate TestEventHandlers;
public event TestEventDelegate TestEvent
{
add
{
lock (TestEventHandlers)
{
TestEventHandlers += value;
}
}
remove
{
lock (TestEventHandlers)
{
TestEventHandlers -= value;
}
}
}
Cheers
Emma
In MSDN, in the Using Events (C# Programming Guide), declaring event
accessors part it uses the following ...
But the lock will fail at the first call to add because
TestEventHandlers is null.
Any ideas how to fix this up? I can't just initialize the event with
something because it doesn't really make sense ...
private TestEventDelegate TestEventHandlers;
public event TestEventDelegate TestEvent
{
add
{
lock (TestEventHandlers)
{
TestEventHandlers += value;
}
}
remove
{
lock (TestEventHandlers)
{
TestEventHandlers -= value;
}
}
}
Cheers
Emma