Click here to Skip to main content
15,891,184 members
Home / Discussions / C#
   

C#

 
AnswerRe: Flow Options opinions Pin
Ennis Ray Lynch, Jr.26-Feb-09 7:05
Ennis Ray Lynch, Jr.26-Feb-09 7:05 
GeneralRe: Flow Options opinions Pin
ffowler26-Feb-09 7:15
ffowler26-Feb-09 7:15 
GeneralRe: Flow Options opinions Pin
Ennis Ray Lynch, Jr.26-Feb-09 7:18
Ennis Ray Lynch, Jr.26-Feb-09 7:18 
GeneralRe: Flow Options opinions Pin
ffowler26-Feb-09 7:20
ffowler26-Feb-09 7:20 
QuestionCan you pass a delegate that contains params object[] parameters to another degelate as a parameter? Pin
Steve Holdorf26-Feb-09 5:48
Steve Holdorf26-Feb-09 5:48 
GeneralRe: Can you pass a delegate that contains params object[] parameters to another degelate as a parameter? Pin
Steve Holdorf26-Feb-09 6:36
Steve Holdorf26-Feb-09 6:36 
AnswerRe: Can you pass a delegate that contains params object[] parameters to another degelate as a parameter? [modified] Pin
Steve Holdorf26-Feb-09 7:57
Steve Holdorf26-Feb-09 7:57 
GeneralRe: Can you pass a delegate that contains params object[] parameters to another degelate as a parameter? Pin
Alan N26-Feb-09 9:30
Alan N26-Feb-09 9:30 
Hi,

Steve Holdorf wrote:
Now, the question I still have is how could I change the OuterDelegate to execute some code on what was returned from the InnerDelegate?


You could restructure slightly and write a method that invokes two delegates sequentially. I can't see any way out of passing all the arguments required for the first delegate as arguments to the invoker.

Also the invoker would need code to format or translate the first delegate's output into something the second can accept.


delegate int D1(params int[] list);
delegate void D2(int p);

class DeliDelegate {
  internal void Run(){
    InvokeBoth(ShowInt, Sum, 1, 2, 3, 4, 5);
    InvokeBothAndSome(ShowInt, Sum, 1, 2, 3, 4, 5);
  }

  void InvokeBoth(D2 outer, D1 inner, params int[] p) {
    outer(inner(p));
  }

  void InvokeBothAndSome(D2 outer, D1 inner, params int[] p) {
    int res = inner(p);
    res = res * 6;
    outer(res);
  }

  int Sum(params int[] i) {
    int result = 0;
    foreach (int j in i) {
      result += j;
    }
    return result;
  }

  void ShowInt(int i) {
    Console.WriteLine("Value is {0}", i);
  }
}

GeneralRe: Can you pass a delegate that contains params object[] parameters to another degelate as a parameter? Pin
Steve Holdorf26-Feb-09 10:11
Steve Holdorf26-Feb-09 10:11 
GeneralRe: Can you pass a delegate that contains params object[] parameters to another degelate as a parameter? Pin
Steve Holdorf26-Feb-09 12:18
Steve Holdorf26-Feb-09 12:18 
AnswerRe: Can you pass a delegate that contains params object[] parameters to another degelate as a parameter? Pin
Ennis Ray Lynch, Jr.26-Feb-09 7:02
Ennis Ray Lynch, Jr.26-Feb-09 7:02 
GeneralRe: Can you pass a delegate that contains params object[] parameters to another degelate as a parameter? Pin
led mike26-Feb-09 7:07
led mike26-Feb-09 7:07 
AnswerRe: Can you pass a delegate that contains params object[] parameters to another degelate as a parameter? Pin
Luc Pattyn26-Feb-09 8:02
sitebuilderLuc Pattyn26-Feb-09 8:02 
GeneralRe: Can you pass a delegate that contains params object[] parameters to another degelate as a parameter? Pin
Steve Holdorf26-Feb-09 8:20
Steve Holdorf26-Feb-09 8:20 
AnswerRe: Can you pass a delegate that contains params object[] parameters to another degelate as a parameter? Pin
Luc Pattyn26-Feb-09 8:38
sitebuilderLuc Pattyn26-Feb-09 8:38 
Questionhow to apply zoom to usercontrol... Pin
priyareguri26-Feb-09 5:10
priyareguri26-Feb-09 5:10 
AnswerRe: how to apply zoom to usercontrol... [modified] Pin
Calin Tatar26-Feb-09 5:25
Calin Tatar26-Feb-09 5:25 
GeneralRe: how to apply zoom to usercontrol... Pin
priyareguri27-Feb-09 4:43
priyareguri27-Feb-09 4:43 
QuestionCrystal report question Pin
E_Gold26-Feb-09 3:56
E_Gold26-Feb-09 3:56 
AnswerRe: Crystal report question Pin
led mike26-Feb-09 4:37
led mike26-Feb-09 4:37 
AnswerRe: Crystal report question Pin
DaveyM6926-Feb-09 4:51
professionalDaveyM6926-Feb-09 4:51 
GeneralRe: Crystal report question Pin
E_Gold26-Feb-09 11:04
E_Gold26-Feb-09 11:04 
GeneralRe: Crystal report question Pin
led mike26-Feb-09 11:24
led mike26-Feb-09 11:24 
Questiondynamically add a flash object to a C# desktop application Pin
Zap-Man26-Feb-09 3:54
Zap-Man26-Feb-09 3:54 
AnswerRe: dynamically add a flash object to a C# desktop application Pin
led mike26-Feb-09 4:34
led mike26-Feb-09 4:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.