I can't quite figure out how to use dynamic proxy how to implement multiple interfaces at the same time. Using a third party library I have something like
interface ISubscribe<T> { Consume(T msg); }
I would like to dynamically create a class that simultaneously implements
ISubscribe<Foo>, ISubscribe<Bar>
and for each one calls Logger.Log(msg)
(the type parameter on that is dynamic).
I can't figure out quite how to do this.
The proxy creation methods have a Type[]
parameter called additionalInterfacesToProxy
. Pass all the extra interfaces you want to proxy through there.