How to deserialize property with the name which is keyword?



I have following XML code:



<sees direction="NE"/><sees direction="E"/><sees direction="SE"><object>diamond</object><background>green</background></sees><sees direction="SW"><background>green</background></sees>


I have problem with deserialzation of object tag. First I wrote manualy property, then I used XSD tool to generate classes and also edited XMLElementAttribute.



System.Xml.Serialization.XmlElementAttribute("object", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string @object
{
get
{
return this.objectField;
}
set
{
this.objectField = value;
}
}


I didn't found way to fullfill this field even when it compiles, and all the rest fields (for example background) work fine.


Is there something what I am missing?


No comments:

Post a Comment