Mono.Cecil.Inject.MethodDefinitionExtensions.InjectWith C# (CSharp) Method

InjectWith() public static method

Inject a hook call into this method.
public static InjectWith ( this method, MethodDefinition injectionMethod, int codeOffset, int tag, InjectFlags flags = InjectFlags.None, InjectDirection dir = InjectDirection.Before, int localsID = null, FieldDefinition typeFields = null ) : void
method this This method that is used as a target.
injectionMethod MethodDefinition The method the call of which to inject.
codeOffset int /// The index of the instruction from which to start injecting. If positive, will count from the /// beginning of the method. If negative, will count from the end. For instance, -1 is the method's last instruction /// and 0 is the first. ///
tag int /// If is specified, the value of this parameter will be passed as a /// parameter to the injection method. ///
flags InjectFlags Injection flags that specify what values to pass to the injection method and how to inject it.
dir InjectDirection The direction in which to insert the call: either above the start code or below it.
localsID int /// An array of indicies of local variables to pass to the injection method. Used only if /// is specified, otherwise ignored. ///
typeFields FieldDefinition /// An array of class fields from the type the target lies in to pass to the injection method. /// Used only if is specified, otherwise ignored. ///
return void
        public static void InjectWith(this MethodDefinition method,
                                      MethodDefinition injectionMethod,
                                      int codeOffset = 0,
                                      int tag = 0,
                                      InjectFlags flags = InjectFlags.None,
                                      InjectDirection dir = InjectDirection.Before,
                                      int[] localsID = null,
                                      FieldDefinition[] typeFields = null)
        {
            InjectionDefinition id = new InjectionDefinition(method, injectionMethod, flags, localsID, typeFields);
            id.Inject(codeOffset, tag, dir);
        }
    }
MethodDefinitionExtensions