D
Darren
When I raise an event I have to first test to see if the event has
been created. For example:
class ClassX
{
public event System.EventsArgs MyEvent;
public void SomeMethod()
{
if (MyEvent != null) MyEvent();
}
}
If there a way of creating the event variable (MyEvent) so it's list
is empty and when I write:
public void SomeMethod()
{
MyEvent();
}
it won't cause an exception and it will raise the event for each
subscriber in the list (and if nobody has subscribed the list will be
empty)?
Thanks in advance,
Darren.
been created. For example:
class ClassX
{
public event System.EventsArgs MyEvent;
public void SomeMethod()
{
if (MyEvent != null) MyEvent();
}
}
If there a way of creating the event variable (MyEvent) so it's list
is empty and when I write:
public void SomeMethod()
{
MyEvent();
}
it won't cause an exception and it will raise the event for each
subscriber in the list (and if nobody has subscribed the list will be
empty)?
Thanks in advance,
Darren.