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?