How to plug method parameters into custom attribute

前端 未结 4 1074
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-19 08:13

I have a custom Attribute called AuthoriseAttribute whose constructor looks like this:

public AuthoriseAttribute(int userId)
{
  .. blah
}

This

4条回答
  •  渐次进展
    2021-02-19 09:01

    Probably because this is an old post but this is now possible

    [MyAttribute(MyAttributeVar= "myMethodVar")]
    public void MyMethod(int myMethodVar)
    

提交回复
热议问题