I want to use reflection to get the AttributeName of an XMLAttribute.
public class Rate{
[XmlAttribute(AttributeName = "roomcode")]
public string Code { get; set; }
}
When I do:
var rate = typeof(Rate).GetProperty("Code").GetCustomAttributes(true);
I can see that there is a property on the object rate with AttributeName "roomcode", but no matter what I try, I can't seem to access it.
I want to do a unit test where I compare the attributenames on my object to the attributenames of an xml node.
Aucun commentaire:
Enregistrer un commentaire