Pass method and call inside function

c#, reflection

Solution

private bool GetMethodExecution(Func<Channel, bool> channelExecutor)
{
   var channel = new Channel();
   return channelExecutor(channel);
}

Now you can pass method via lambda like:

GetMethodExecution(ch => ch.method1());

GetMethodExecution(ch => ch.method2());

Problem

i have object `var channel = new Chanel();` this object has several methods which i call inside function like this: ``` private bool GetMethodExecution() { var channel = new Channel(); channel.method1(); channel.method2(); } ``` all methods of class `Channel` derives from interface `IChannel`. My question is how can i call method `GetMethodExecution()` and pass which method I want to execute and then execute it inside this function based on parameter passed. What i need is to call GetMethodExectution(IChannle.method1) and then call it on object inside this function. Is this possible

Original source