简体   繁体   中英

C# Custom annotation to wrap code with try/catch

I am looking for explanation how to create custom annotation, that i can put anywhere in my code and on compilation it will wrap code block followed by this annotation, with try and catch. Its ok if this solution will be only available for methods. All examples i read here , does not give me direction where to find desired solution.

Attributes just decorate classes and methods. You need to look for AOP (Aspect Oriented Programming) for better directions.

You can start with this article

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM