Implement method decorators in C#

前端 未结 4 1515
忘了有多久
忘了有多久 2020-12-31 12:48

In python is possible to implement function decorators to extend the behavior of functions and methods.

In particular I\'m migrating a devi

4条回答
  •  不思量自难忘°
    2020-12-31 13:15

    You can achieve something similar using Aspect Oriented Programming. I've only used PostSharp in the past but it's not free for commercial use though.

    There are other AOP solutions out there and you can certainly achieve something similar using Mono.Cecil, but it would require more work.

    Reza Ahmadi wrote a nice little introduction article called Aspect Oriented Programming Using C# and PostSharp. It can give you a clear enough idea of what to expect and how it works.

提交回复
热议问题