namespace Annotations_Multiple { using HarmonyLib; using System.Collections.Generic; using System.Linq; using System.Reflection; public class Example { // [HarmonyPatch] // make sure Harmony inspects the class class MyPatches { static IEnumerable TargetMethods() { return AccessTools.GetTypesFromAssembly(someAssembly) .SelectMany(type => type.GetMethods()) .Where(method => method.ReturnType != typeof(void) && method.Name.StartsWith("Player")) .Cast(); } // prefix all methods in someAssembly with a non-void return type and beginning with "Player" static void Prefix(object[] __args, MethodBase __originalMethod) { // use dynamic code to handle all method calls var parameters = __originalMethod.GetParameters(); FileLog.Log($"Method {__originalMethod.FullDescription()}:"); for (var i = 0; i < __args.Length; i++) FileLog.Log($"{parameters[i].Name} of type {parameters[i].ParameterType} is {__args[i]}"); } } // class MyCode { } public static Assembly someAssembly; } }