使用属性拦截然后重新发出方法调用 [英] Using attributes to intercept then reissue method calls

查看:79
本文介绍了使用属性拦截然后重新发出方法调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个放置时的方法它的一个属性:

I'd like create an attribute that when placed on a method it:


  1. 检查的条件

  2. 如果属实,执行的方法,如有虚假,它执行它调用回调原来的方法异步方法。

任何想法?

推荐答案

这是一个方法放置一个属性不影响方法本身。你将不得不写code,它这种转变,然后使用类似PostSharp应用转变到每一个标有属性的方法你编译后。

Placing an attribute on a method doesn't affect the method itself. You would have to write code that does this transformation, then use something like PostSharp to apply the transformation to every method marked with the attribute after you have compiled it.

这篇关于使用属性拦截然后重新发出方法调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆