小编mcd*_*man的帖子

如何获取属性设置的属性名称?

我将在不传递属性的任何参数的情况下执行此操作!可能吗?

class MyAtt : Attribute {
    string NameOfSettedProperty() {
        //How do this? (Would be MyProp for example)
    }
}

class MyCls {
    [MyAtt]
    int MyProp { get { return 10; } }
}
Run Code Online (Sandbox Code Playgroud)

c# reflection attributes

33
推荐指数
2
解决办法
2万
查看次数

标签 统计

attributes ×1

c# ×1

reflection ×1