static void Main() { TestClass obj = new TestClass(); TestSubClass subObj = new TestSubClass(); OtherSubClass otherObj = new OtherSubClass(); obj.TestMethod(); subObj.TestMethod(); otherObj.TestMethod(); try { RedirectionHelper.RedirectCalls(typeof(TestSubClass).GetMethod("TestMethod"), typeof(DetourClass).GetMethod("TestMethod")); obj.TestMethod(); subObj.TestMethod(); otherObj.TestMethod(); } catch (Exception e) { Console.Out.WriteLine(e); } }