Can I create an Action delegate with a lambda expression like this () => Method(args) dynamically when I have the target, MethodInfo and arguments to pass in?
Say I had a method that took an int argument and wanted to assign an Action delegate to call it with the argument 1 like so Action action = () => Method(1), but I want to do it dynamically. You could make a delegate and assign the action to dynamically invoke it, or assign it to invoke the method, but the performance is terrible.
public class DelegateData
{
public object target;
public MethodInfo method;
public object[] args;
}