Is there a way to create a proxy of a delegate type and have it implement additional interfaces in DynamicProxy2 and also being able to intercept calls to the generated delegate?
The way i normaly generate proxies throws an exception because delegate types are sealed.
Patrik,
You don't need DynamicProxy to 'proxy' delegates This should be enough:
Action delegateToproxy = new Foo().Bar; //Bar is public void Bar(){}
Action proxy = delegate
{
Console.WriteLine("Intercepted!");
delegateToProxy();
}
return proxy;
[UPDATE: that aswer was not relevant to this specific problem] What kind of API do you want to expose for this?
If you want to follow up with this conversation please contact me via email, or start a thread on Castle users group.