Show / Hide Table of Contents

Class HarmonyPatch

Annotation to define your Harmony patch methods

Inheritance
object
Attribute
HarmonyAttribute
HarmonyPatch
HarmonyDelegate
Inherited Members
HarmonyAttribute.info
Namespace: HarmonyLib
Assembly: 0Harmony.dll
Syntax
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Method|AttributeTargets.Delegate, AllowMultiple = true)]
public class HarmonyPatch : HarmonyAttribute

Constructors

HarmonyPatch()

An empty annotation can be used together with TargetMethod(s)

Declaration
public HarmonyPatch()

HarmonyPatch(MethodType)

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(MethodType methodType)
Parameters
Type Name Description
MethodType methodType

The MethodType

HarmonyPatch(MethodType, params Type[])

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(MethodType methodType, params Type[] argumentTypes)
Parameters
Type Name Description
MethodType methodType

The MethodType

Type[] argumentTypes

An array of argument types to target overloads

HarmonyPatch(MethodType, Type[], ArgumentType[])

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(MethodType methodType, Type[] argumentTypes, ArgumentType[] argumentVariations)
Parameters
Type Name Description
MethodType methodType

The MethodType

Type[] argumentTypes

An array of argument types to target overloads

ArgumentType[] argumentVariations

An array of ArgumentType

HarmonyPatch(string)

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(string methodName)
Parameters
Type Name Description
string methodName

The name of the method, property or constructor to patch

HarmonyPatch(string, MethodType)

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(string methodName, MethodType methodType)
Parameters
Type Name Description
string methodName

The name of the method, property or constructor to patch

MethodType methodType

The MethodType

HarmonyPatch(string, string, MethodType)

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(string typeName, string methodName, MethodType methodType = MethodType.Normal)
Parameters
Type Name Description
string typeName

The full name of the declaring class/type

string methodName

The name of the method, property or constructor to patch

MethodType methodType

The MethodType

HarmonyPatch(string, params Type[])

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(string methodName, params Type[] argumentTypes)
Parameters
Type Name Description
string methodName

The name of the method, property or constructor to patch

Type[] argumentTypes

An array of argument types to target overloads

HarmonyPatch(string, Type[], ArgumentType[])

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(string methodName, Type[] argumentTypes, ArgumentType[] argumentVariations)
Parameters
Type Name Description
string methodName

The name of the method, property or constructor to patch

Type[] argumentTypes

An array of argument types to target overloads

ArgumentType[] argumentVariations

An array of ArgumentType

HarmonyPatch(Type)

An annotation that specifies a class to patch

Declaration
public HarmonyPatch(Type declaringType)
Parameters
Type Name Description
Type declaringType

The declaring class/type

HarmonyPatch(Type, MethodType)

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(Type declaringType, MethodType methodType)
Parameters
Type Name Description
Type declaringType

The declaring class/type

MethodType methodType

The MethodType

HarmonyPatch(Type, MethodType, params Type[])

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(Type declaringType, MethodType methodType, params Type[] argumentTypes)
Parameters
Type Name Description
Type declaringType

The declaring class/type

MethodType methodType

The MethodType

Type[] argumentTypes

An array of argument types to target overloads

HarmonyPatch(Type, MethodType, Type[], ArgumentType[])

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(Type declaringType, MethodType methodType, Type[] argumentTypes, ArgumentType[] argumentVariations)
Parameters
Type Name Description
Type declaringType

The declaring class/type

MethodType methodType

The MethodType

Type[] argumentTypes

An array of argument types to target overloads

ArgumentType[] argumentVariations

Array of ArgumentType

HarmonyPatch(Type, string)

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(Type declaringType, string methodName)
Parameters
Type Name Description
Type declaringType

The declaring class/type

string methodName

The name of the method, property or constructor to patch

HarmonyPatch(Type, string, MethodType)

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(Type declaringType, string methodName, MethodType methodType)
Parameters
Type Name Description
Type declaringType

The declaring class/type

string methodName

The name of the method, property or constructor to patch

MethodType methodType

The MethodType

HarmonyPatch(Type, string, params Type[])

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(Type declaringType, string methodName, params Type[] argumentTypes)
Parameters
Type Name Description
Type declaringType

The declaring class/type

string methodName

The name of the method, property or constructor to patch

Type[] argumentTypes

An array of argument types to target overloads

HarmonyPatch(Type, string, Type[], ArgumentType[])

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(Type declaringType, string methodName, Type[] argumentTypes, ArgumentType[] argumentVariations)
Parameters
Type Name Description
Type declaringType

The declaring class/type

string methodName

The name of the method, property or constructor to patch

Type[] argumentTypes

An array of argument types to target overloads

ArgumentType[] argumentVariations

Array of ArgumentType

HarmonyPatch(Type, Type[])

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(Type declaringType, Type[] argumentTypes)
Parameters
Type Name Description
Type declaringType

The declaring class/type

Type[] argumentTypes

The argument types of the method or constructor to patch

HarmonyPatch(Type[])

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(Type[] argumentTypes)
Parameters
Type Name Description
Type[] argumentTypes

An array of argument types to target overloads

HarmonyPatch(Type[], ArgumentType[])

An annotation that specifies a method, property or constructor to patch

Declaration
public HarmonyPatch(Type[] argumentTypes, ArgumentType[] argumentVariations)
Parameters
Type Name Description
Type[] argumentTypes

An array of argument types to target overloads

ArgumentType[] argumentVariations

An array of ArgumentType

In this article
Back to top Generated by DocFX