mirror of
https://github.com/pardeike/Harmony
synced 2026-06-08 16:40:38 +00:00
24 lines
508 B
C#
24 lines
508 B
C#
namespace Patching_Auxiliary
|
|
{
|
|
using HarmonyLib;
|
|
using System.Collections.Generic;
|
|
using System.Reflection;
|
|
|
|
class Foo { }
|
|
class Bar { }
|
|
|
|
class Example
|
|
{
|
|
// <yield>
|
|
static IEnumerable<MethodBase> TargetMethods()
|
|
{
|
|
// if possible use nameof() or SymbolExtensions.GetMethodInfo() here
|
|
yield return AccessTools.Method(typeof(Foo), "Method1");
|
|
yield return AccessTools.Method(typeof(Bar), "Method2");
|
|
|
|
// you could also iterate using reflections over many methods
|
|
}
|
|
// </yield>
|
|
}
|
|
}
|