Execute a method using the Action <T> argument using Reflection
How can I create an Action method to use as an argument for the next function?
public void When(Action<T> action) { if (internalValue != null) action(internalValue); } I have MethodInfo by method and parameter type, for example:
var methods = value.GetType().GetMethods(); MethodInfo mInfo = methods.First(method => method.Name == "When"); Type parameterType = (mInfo.GetParameters()[0]).ParameterType; But after that I have no idea how to make the actual action method passed as an argument, I also donβt know how to define the body of the Action method.
+4