william007
asked on
Call compositedelegate by position
Consider following code:
delegate int MyDelegate();
MyDelegate d1=new MyDelegate(M1);
MyDelegate d2=new MyDelegate(M2);
MyDelegate d3=new MyDelegate(M3);
MyDelegate compDelegate=d1+d2+d3;
public void delegateCall(MyDelegate myCompDelegate, int Position){
//call the method by position
}
If I call delegate(compDelegate,2), meaning I want the second method to be called, in our case, d2.
How to do this?
delegate int MyDelegate();
MyDelegate d1=new MyDelegate(M1);
MyDelegate d2=new MyDelegate(M2);
MyDelegate d3=new MyDelegate(M3);
MyDelegate compDelegate=d1+d2+d3;
public void delegateCall(MyDelegate myCompDelegate, int Position){
//call the method by position
}
If I call delegate(compDelegate,2), meaning I want the second method to be called, in our case, d2.
How to do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I would request to PAQ this question, since it is self answered :)
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
Vee_Mod
Community Support Moderator
Bob