Hello,
I've got a method (fyi, I'm using c#), accepting a parameter of type "Func", let's say it's defined as such:
MethodAcceptingFuncParam(Func<bool> thefunction);
I've defined the function to pass in as such:
public bool DoStuff()
{
return true;
}
I can easily call this as such:
MethodAcceptingFuncParam(() => { return DoStuff(); });
This works as it should, so far so good.
Now, instead of passing in the DoStuff() method, I would like to create this method through reflection, and pass this in:
Type containingType = Type.GetType("Namespace.ClassContainingDoStuff");
MethodInfo mi = containingType.GetMethod("DoStuff");
=> this works, I can get the methodinfo correctly.
But this is where I'm stuck: I would now like to do something like
MethodAcceptingFuncParam(() => { return mi.??? });
In other words, I'd like to pass in the method I just got through reflection as the value for the Func param of the MethodAcceptingFuncParam method. Any clues on how to achieve this?