Can I redirect .NET method calls to a new method at runtime?

后端 未结 5 887
我在风中等你
我在风中等你 2021-01-13 21:26

Suppose I have the following .NET classes:

public class C
{
    public void M()
    {
        ....
    }
}

and

public class         


        
5条回答
  •  -上瘾入骨i
    2021-01-13 21:50

    Microsoft has created a managed equivalent to Detours called Moles. The only thing I'm not sure of is the licensing; it is intended for testing (as part of Pex).

    Dependency injection requires modifying the source; PostSharp requires modifying the binary; but Moles can be done dynamically at runtime.

提交回复
热议问题