0
如何將方法調用轉換爲Action
類,包括其參數?它甚至有可能嗎?被截獲Castle Windsor - 攔截方法並將其轉換爲Action類
Queue<Action> queue = new Queue<Action>();
樣品的方法:
public string DoSomeStuff(string[] arr)
{
//some logic here
}
攔截器(溫莎城堡):
public class MyInterceptor : IInterceptor
{
public void Intercept(IInvocation invocation)
{
if (queue.Count > 0)
{
queue.Enqueue(() => {
//here, add intercepted method (DoSomeStuff) and its parameters
});
}
}
}