When you have a class car that implements IVehicle and you want to wrap it in a decorator that forwards all calls to car and counts them, how would you do it?
In Ruby I could just build a decorator without any methods and use method_missing to forward all calls to the car object.
In Java I could build a Proxy object that runs all code through one method and forwards it afterwards.
Is there any similiar thing i can do in C#?
update:
based on the answeres and what i´ve read about System.Reflection.Emit it should be possible to write a method similiar to this:
Type proxyBuilder(Type someType, delagate functionToBeApplied, Object forward)
where type implements all interface of someType, executes functionToBeApplied and then forwards the method call to object while returning its return.
Is there some lib that does just that or would i have to write my own?