Prev: How to handle an exception of type ThreadAbortException -- please help!!
Next: WriteXML and xmlns attribute
From: Tony Johansson on 24 May 2010 16:38 Hi! Is it possible to rewrite this code in such a way that I get something like event AlarmEventHandler myEvent; I'm not so used to code when it is written in this way. //Here is the Code If AlarmEventArgs e = new AlarmEventArgs(1,2); AlarmEventHandler handler = Alarm; if (handler != null) { handler(this, e); } //Tony
From: "Roger" rjpd AT NOnetzeroSPAM DOT on 24 May 2010 16:55
public event AlarmEventHandler myEvent; The subscriber should: myEvent += MyHandler; Then the publisher should call it when appropriate: if (myEvent != null) { AlarmEventArgs e = new AlarmEventArgs(1,2); myEevent(this, e); } I think this is about it, not tested though. Roger > I'm not so used to code when it is written in this way. > > //Here is the Code > If AlarmEventArgs e = new AlarmEventArgs(1,2); > AlarmEventHandler handler = Alarm; > > if (handler != null) > { > handler(this, e); > } > > //Tony > |