Design Strongly typed object from XML

前端 未结 5 1573
Happy的楠姐
Happy的楠姐 2020-12-18 04:56

I have a couple of XML files that I need to work with, and I\'ve always used the XElement objects and pulled the data via the attribute name or the XElement\'s value.

<
5条回答
  •  一向
    一向 (楼主)
    2020-12-18 05:35

    You could put annotations on your class and then use an XmlSerializer to serialize/deserialize your class instances to/from XML - if you need a more customized approach have your class also implement IXmlSerializable then put that serialization/deserialization code within the class.

提交回复
热议问题