Closed BlueRaja closed 1 year ago
How do you override a method defined as an explicit interface implementation?
For example:
public interface IMyInterface { bool MyMethod(); } public class MyClass : IMyInterface { public bool IMyInterface.MyMethod() { return false; } }
How can we override MyClass.MyMethod? Neither of these work in BepInEx 5.4.21 (HarmonyX 2.7.0):
MyClass.MyMethod
[HarmonyPatch(typeof(MyClass), "MyMethod")] [HarmonyPatch(typeof(MyClass), "IMyInterface.MyMethod")]
I figured it out shortly after posting. It has to be
[HarmonyPatch(typeof(MyClass), "Full.Namespace.Goes.Here.IMyInterface.MyMethod")]
How do you override a method defined as an explicit interface implementation?
For example:
How can we override
MyClass.MyMethod
? Neither of these work in BepInEx 5.4.21 (HarmonyX 2.7.0):