【发布时间】:2012-09-14 08:17:45
【问题描述】:
我正在尝试读取包含多个相同类型属性的方法的所有属性,例如:
[field(Feld = "x86", Index = 1)]
[field(Feld = "x93", Index = 2)]
...
[field(Feld = "x107", Index = 9)]
public string Methodename() {}
读取属性如下:
Attribute mAttr = Attribute.GetCustomAttribute
(methodInfo, typeof (fieldAttribute), false) as fieldAttribute;
这会抛出一个AmbiguousMatchException。如何读取多个属性?
谢谢
【问题讨论】:
标签: c# exception reflection custom-attributes