E
Einar Høst
Hi,
I'm using delegates to show progress when performing certain tasks. However,
I'd like to check to see that there actually is a method available for the
delegate to call. What's the correct way of doing that? Looking at the
documentation for delegates, I've come up with:
if (MyEvent.Target != null)
{
MyEvent(this, new MyEventArgs());
}
Still, this would be correct for instance methods only, right? Would this be
better?
if (MyEvent.Method != null)
{
MyEvent(this, new MyEventArgs());
}
Thanks,
Einar.
I'm using delegates to show progress when performing certain tasks. However,
I'd like to check to see that there actually is a method available for the
delegate to call. What's the correct way of doing that? Looking at the
documentation for delegates, I've come up with:
if (MyEvent.Target != null)
{
MyEvent(this, new MyEventArgs());
}
Still, this would be correct for instance methods only, right? Would this be
better?
if (MyEvent.Method != null)
{
MyEvent(this, new MyEventArgs());
}
Thanks,
Einar.