G
Guest
Hi all:
My class has one event that gets fired on a timer, typically only one
function consumes it on the receiving end.
// Source Class
public delegate void DataHandler(ArrayList aList);
public event DataHandler DataEvent;
...
...
DataEvent.BeginInvoke(new ArrayList(),null,null);
// The Sink Class
mySourceObj.DataEvent += new DataHandler(OnData);
Everything works just fine but when I try to add another consumer to the
same event (mySourceObj.DataEvent += new DataHandler(OnData2)
I get this
runtime exception:
"The delegate must have only one target"
I'm assuming that I need to implement a MulticastDelegate but I can't find a
good example on how to do that. Could someone show me how to convert the
above code to using Multicast Delegates.
Thanks
Ed;;
My class has one event that gets fired on a timer, typically only one
function consumes it on the receiving end.
// Source Class
public delegate void DataHandler(ArrayList aList);
public event DataHandler DataEvent;
...
...
DataEvent.BeginInvoke(new ArrayList(),null,null);
// The Sink Class
mySourceObj.DataEvent += new DataHandler(OnData);
Everything works just fine but when I try to add another consumer to the
same event (mySourceObj.DataEvent += new DataHandler(OnData2)

runtime exception:
"The delegate must have only one target"
I'm assuming that I need to implement a MulticastDelegate but I can't find a
good example on how to do that. Could someone show me how to convert the
above code to using Multicast Delegates.
Thanks
Ed;;