c# - Is there a way to make every class in a project implement an interface (without doing a bulk find and replace) -
is there way this: in groovy there way decorate every class add together tracing? in c#. since c# doesn't back upwards metaclass i'm stuck how it. if solution work so iterate through every class using reflection , create implement interface.
thanks,
joe
yes, can utilize dynamic proxies.
why don't take @ castle dynamicproxy? http://www.castleproject.org/projects/dynamicproxy/
or postsharp, if want leverage aop in cleaner way:
http://www.sharpcrafters.com/postsharp/documentation
updatethe op said in comment:
ah, i'm using postsharp output methods called , when. i'm tring avoid having though adding attribute every class in code. figured create interface this: [myattribute] public interface idebug {} , create classes implement interface @ runtime.
postsharp supports assembly-level aspects: [assembly:youraspect]
. later, in aspect, can check method invoked , object belongs to, , whole job depending on that.
c# reflection metaclass
No comments:
Post a Comment