我有幾個基本屬性的類...使用反射來找到[XmlAttribute(「IWantThisValueRightHere」)
[XmlAttribute("MyFirstProperty")]
public string FirstProperty { get; set; }
[XmlAttribute("MySecondProperty")]
public string SecondProperty { get; set; }
使用反射,我可以通過公共屬性枚舉並得到每個的PropertyInfo對象上述特性的......我現在唯一需要的是一種方法:
- 檢測的財產是否有一個XmlAttribute(我想通過PropertyInfo.IsDefined(typeof運算(XmlAttribute這個工程),真的)但想確認)
- 獲取XmlAttribute的字符串值
這是如何完成的?
。 System.Object沒有AttributeName屬性。 – 2009-06-19 18:19:29