CodeInject
CodeInject copied to clipboard
Question: How can I write a generic injection that accepts any number of parameters
I am trying to write an injector to accept any number of parameters. By "injector" I mean the method which would be injected into another existing method. That method would look like
public static class MethodDefinitionInjector
{
public static DumpParameter(params object[] args)
{
foreach(object o in args) ...
}
}
I can only get it to work when the parameters perfectly match. I'm injecting in the following manner:
methodDefinitionToInject.InjectWith(methodDefinitionInjector, 0, null, InjectFlags.PassParametersVal, InjectDirection.Before, null, null);
Is this possible? How should I rewrite the injection?