public static GenericFuncContainer <MethodDefinition, bool> MethodOPCodeComparer(int[] indices, OpCode[] opCodes, object[] operands) { if (indices.Length != opCodes.Length || (operands != null && operands.Length != opCodes.Length)) { OnError(ErrorCode.INVALID_PARAMETER, "MethodOPCodeComparer : all arrays should have the same size"); return(null); } return(new GenericFuncContainer <MethodDefinition, bool>(method => { Instruction[] instrs = method.Body.Instructions.ToArray(); for (int i = 0; i < indices.Length; i++) { int index = indices[i] < 0 ? (instrs.Length + indices[i]) : indices[i]; if ((index > instrs.Length) || (index < 0)) { return false; } if (!HelperClass.OPMatches(instrs[index], opCodes[i], (operands != null) ? operands[i] : null)) { return false; } } return true; })); }