Click here to Skip to main content
15,890,973 members
Home / Discussions / C#
   

C#

 
QuestionFlow Options opinions Pin
ffowler26-Feb-09 5:51
ffowler26-Feb-09 5:51 
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 
This is how it is done:

using System;

namespace ConsoleApplication1
{
    public class Program
    {
        public delegate int OuterDelegate(object[] o);
        public delegate int InnerDelegate(object[] o);

        public int MyMethod(object[] o)
        {
            int t = 0;
            foreach (object io in o)
            {
                t += (int)io;
            }
            return t;
        }


        static void Main(string[] args)
        {
            Program p = new Program();

            InnerDelegate oInnerDelegate = new InnerDelegate(p.MyMethod);
            OuterDelegate oOuterDelegate = new OuterDelegate(oInnerDelegate);

            int i = oOuterDelegate(new object[] { 1, 2, 3, 4 });
            Console.WriteLine(i.ToString());

            Console.WriteLine("done");
            Console.Read();
        }        
    }
}


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

Thanks,


Steve

modified on Thursday, February 26, 2009 2:34 PM

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 
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 

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.