Different methods using Functors/Delegates in c#

Posted by mo alaz on Stack Overflow See other posts from Stack Overflow or by mo alaz
Published on 2012-10-30T10:51:58Z Indexed on 2012/10/30 11:01 UTC
Read the original article Hit count: 130

Filed under:
|
|

I have a method that I call multiple times, but each time a different method with a different signature is called from inside.

public void MethodOne()
{
//some stuff

*MethodCall();

//some stuff

}

So MethodOne is called multiple times, each time with a different *MethodCall(). What I'm trying to do is something like this :

public void MethodOne(Func<> MethodCall)
{
//some stuff

*MethodCall;

//some stuff

}

but the Methods that are called each have a different return type and different parameters. Is there a way to do this using Functors? If not, how would I go about doing this?

Thank you!

© Stack Overflow or respective owner

Related posts about c#

Related posts about delegates